Hi, I'm trying to cycle through the children elements of a parent and
store their ID's in a variable. But I am having trouble updating the
variable properly. It's overwriting the variable instead of adding to
it. I was wondering if anyone could tell me where the error is in this.
*edit* ok I think I solved it actually. Though it's crude... is this an
acceptable method?
$("#size4").click(function() {
var child;
var idList;
var newidList;
$(this).each(function() {
$(this).children().each(function() {
child = $(this).attr("id");
idList = idList + " " + child;
newidList = idList.replace("undefined", "");
alert(newidList);
});
});
});