scarhand Posted September 11, 2010 Share Posted September 11, 2010 lets say i have the following code: <div id="parent"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> how would i get item1, item2, and item3 (just the id's) into an array? was looking into childnodes but wasn't clear on this... Link to comment https://forums.phpfreaks.com/topic/213171-get-all-ids-within-an-id/ Share on other sites More sharing options...
scarhand Posted September 11, 2010 Author Share Posted September 11, 2010 i got what i was trying to do: var cids = Array.prototype.slice.call(document.getElementById(theid).getElementsByTagName('input')); for (var j = 0, len = cids.length; j < len; ++j) { // do stuff with the objects } Link to comment https://forums.phpfreaks.com/topic/213171-get-all-ids-within-an-id/#findComment-1110000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.