jQuery: Trouble inserting DOM elements
- by Rosarch
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.