Try out the following. Get element by ID and display it's ID. You'd think it would be the same id that was just asked for, in this case 'child'...
< type="checkbox" onclick="alert('child = ' + document.getElementById('child').id)">
< type="hidden" name="child" id="hidden_child">
< type="checkbox" id="child">

To work around this - make sure you keep id's unique to each other and to elements that are named. Or be sure the id elements are found first, in document order.
1 comments: