I\'m trying to use the append function and encountered this:
$(\"#details\").append(\'\');
for (var i = 0; i < 10; i++) {
$(\"#details\").ap
No, it's a programmer bug. s are attached to their
or
, not to its container. And appending a close tag is nonsensical.
You're basically working as if what you were appending were raw HTML, and it's not; you're actually working with the DOM.
Try this:
var list = $("#details").append('
').find('ul');
for (var i = 0; i < 10; i++)
list.append('- something
');
Note: please see (and upvote) Blixt's answer, which expands on a couple different options that are superior for various purposes. It deserves attention and hasn't been getting it.