Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  62] [ 2]  / answers: 1 / hits: 47830  / 13 Years ago, sat, july 30, 2011, 12:00:00

Doing an alert() on one of my variables gives me this result



  [object NodeList]


How can I see all the values in that?



Note; I am on Firefox and dont know how to use chromebug so its not installed.


More From » nodelist

 Answers
42

You can iterate the values in a NodeList the same way you would an array:



for (var index = 0; index < nodeList.length; index++) {
alert(nodeList[index]);
}


Here is a good resource with some more in-depth information: https://web.archive.org/web/20170119045716/http://reference.sitepoint.com/javascript/NodeList


[#90914] Thursday, July 28, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mathewb

Total Points: 535
Total Questions: 95
Total Answers: 96

Location: British Indian Ocean Territory
Member since Fri, Oct 15, 2021
3 Years ago
;