.innerhtml
Breaking
Why is this breaking? I've not used .innerHTML correctly before and don't know why this would be wrong. function asdf() { document.getElementById('qwerty').innerHTML='A
Solution 1:
You have to escape new-lines in JavaScript string-literals:
functionasdf() {
document.getElementById("qwerty").innerHTML="A<br>\
B<br>\
C<br>\
D<br>";
}
Though you could, potentially more-easily, simply insert newlines in the string itself:
functionasdf() {
document.getElementById("qwerty").innerHTML = "A<br>\nB<br>\nC<br>\nD<br>";
}
Post a Comment for ".innerhtml
Breaking"