Forum Moderators: open
It is more complicated if you do not know which elements you're looking for. You'd have to parse the entire document tree.
function labelOnclick( )
{
labels = document.getElementsByTagName("label");
for( var i = 0; i < labels.length; i++ )
{
if( labels[i].className == 'checks' )
labels[i].onclick = toggleColor( labels[i].id );
}
}
Well, it's not working. My toggleColor function is being called for each label when the document loads and the onclick does not work for any of the labels.
Any ideas?