jQuery: Trouble inserting DOM elements
Posted
by Rosarch
on Stack Overflow
See other posts from Stack Overflow
or by Rosarch
Published on 2010-05-03T22:28:15Z
Indexed on
2010/05/03
22:38 UTC
Read the original article
Hit count: 302
I want to add a set of lists to the children of another DOM element:
var req_subsets = $("#req_subsets");
$.each(subsets, function(index, subset) {
var subset_list = $("<ul></ul>");
// add DOM elements to subset_list
req_subsets.append(subset_list);
});
However, only one DOM element is ever added. This makes me suspect that when I assign a new value to subset_list
, the old one is overwritten. If that is the problem, how do I avoid it? If not, what else am I doing wrong?
UPDATE: I changed something else, and I'm almost entirely certain that this is fixed.
© Stack Overflow or respective owner