Reputation: 5780
I've got some code that works great in FireFox, but in IE, the input doesn't work. The text at the beginning there comes out just fine ("track number 1", etc), but the input just doesn't seem to exist... I've been racking my brain trying to figure this stupid thing out and can't get anywhere! The code is executed simply by clicking a button. And I know the code works because it does this about 8 times and the track number labels always work fine. The inputs... nothing.
function addInput(divName, inputType) {
var newdiv = document.createElement('div');
counterText++;
newdiv.innerHTML = "<label for='trackNumber"+counterText+"' id='trackNumber"+counterText+"Lbl'>* Track Number " + (counterText) + "</label> <br><input type='text' class='input-text' style='width: 270px;' name='trackNumber"+counterText+"' id='trackNumber"+counterText+">";
document.getElementById(divName).appendChild(newdiv);
}
Is there any more info anyone needs??
Upvotes: 1
Views: 116
Reputation: 187050
You were missing a single quotes at the end of the id attribute of the text box. Change your code to the following one and it will be fine.
newdiv.innerHTML = "<label for='trackNumber"+counterText+"' id='trackNumber"+counterText+"Lbl'>* Track Number " + (counterText) + "</label> <br><input type='text' class='input-text' style='width: 270px;' name='trackNumber"+counterText+"' id='trackNumber"+counterText+"' />";
Upvotes: 3