Jquery append() is not appending as expected

Posted by KallDrexx on Stack Overflow See other posts from Stack Overflow or by KallDrexx
Published on 2010-05-16T02:50:37Z Indexed on 2010/05/16 3:00 UTC
Read the original article Hit count: 288

Filed under:
|

So I have the following div

<div id="object_list">

I want to append a list and items into it. So I run the following jquery

       $("#object_list").empty();
       $("#object_list").append('<ul');
       $("#object_list").append(list.contents());
       $("#object_list").append('</ul>');

After that code runs, #object_list looks like this

<div id="object_list">
  <ul></ul>
  ...list.contents() elements
</div>

Even after debugging, if I do another $("#object_list").append('<ul>'); all I get is an added <ul> after the </ul>. Why is jquery not appending to the html AFTER the list.contents(), but is going before it?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about append