Element ID from document.getElementsByClassName

SharatLaishram

New Member
Relatively new to JS/Ajax, so I may be missing something obvious here. Let's say at some point in javascript I run ajax to get a number of div elements with a certain class name. I then want to retrieve the html id tag from each of these elements and do something with that information (say populate the element), something like so.\[code\]var divstopop = document.getElementsByClassName("popField"),x; for(x in divstopop){ divstopop[x].innerHTML= x.id; //x.id or something?}\[/code\]Is this in any way possible to do?
 
Back
Top