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... Quote Link to comment 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 } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.