Scip Posted June 26, 2009 Share Posted June 26, 2009 Using fire bug it seems my elements have "\n" new line statements are childNodes, is this normal? It's really annoying because i can't use firstChild or nextSibling statement. I have to pull elements using the getelementBytagName statement. Does this have something do with how html is coded? For instanace i am tyring to pull tr and td from a table but i have not nested these in a tbody tag. Link to comment https://forums.phpfreaks.com/topic/163782-childnode-problem/ Share on other sites More sharing options...
rhodesa Posted June 26, 2009 Share Posted June 26, 2009 yes, the whitespace between actual HTML elements is considered a "text node" specifically for tables though, you can navigate them as arrays: var rows = document.getElementById('table_name').rows; for(var r=0;r < rows.length;r++){ var cells = rows[r].cells; alert('The first cell is '+cells[0].innerHTML); } Link to comment https://forums.phpfreaks.com/topic/163782-childnode-problem/#findComment-864236 Share on other sites More sharing options...
Scip Posted June 27, 2009 Author Share Posted June 27, 2009 Thanks, i will try this next time hopefully it will make the code cleaner and less confusing. Link to comment https://forums.phpfreaks.com/topic/163782-childnode-problem/#findComment-864547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.