Hello,
I've got this pesky problem with the IE under Mac (5.1). Here's the code.
var myTable = document.getElementById("tableID").getElementsByTagName("tbody")[0];
var myRow = document.createElement('TR');
var myTD = document.createElement('TD');
var elem = document.createElement('select');
elem.setAttribute('name', 'my_name');
myTD.appendChild(elem);
myRow.appendChild(myTD);
myTable.appendChild(myRow);
The problem is that after appending the row into the table, I can't access the element by doing the usual document.forms[0].my_name
or
document.forms[0].elements['my_name']
The only way this works is if I set the "id" attribute for the control with setAttribute('id', 'my_name') and then do document.getElementById('my_name').
I've got this pesky problem with the IE under Mac (5.1). Here's the code.
var myTable = document.getElementById("tableID").getElementsByTagName("tbody")[0];
var myRow = document.createElement('TR');
var myTD = document.createElement('TD');
var elem = document.createElement('select');
elem.setAttribute('name', 'my_name');
myTD.appendChild(elem);
myRow.appendChild(myTD);
myTable.appendChild(myRow);
The problem is that after appending the row into the table, I can't access the element by doing the usual document.forms[0].my_name
or
document.forms[0].elements['my_name']
The only way this works is if I set the "id" attribute for the control with setAttribute('id', 'my_name') and then do document.getElementById('my_name').