mercredi 4 juin 2014

appendChild of undefined when Append element to


Vote count:

0




Does anyone here know how to fix this problem or having a similar problem? Please kindly tell me if i wrote the code wrong. Thanks before.



<script type='text/javascript'>

//Getting table by id
var table = document.getElementById(str);

//Creating New Row
var row = document.createElement("tr");

//Creating New TD
var td1 = document.createElement('td');

//Creating new input.
var newInput= document.createElement('input');
newInput.setAttribute('type', 'text');
newInput.setAttribute('class', 'quantity');

//Appending newInput to TD - Return Appendchild of undefined
td1.appenChild(newInput);

//Append td to tr
row.appendChild(td1);

//Append tr to table
table.children[0].appendChild(row);

</script>


asked 21 secs ago






Aucun commentaire:

Enregistrer un commentaire