Adding element after others
I have a page with several uls which are enclosed within a div like so:
- <div id="post_holder">
- <ul>
- <li></li>
- </ul>
- <ul>
- <li></li>
- </ul>
- </div>
i am trying to insert another ul underneath the others within the div. however it inserts the new ul underneath the first ul in the list rather than at the bottom. can anyone see where i am going wrong?
- var ni = document.getElementById('post_holder');
- var new_post = document.createElement('ul');
- ni.parentNode.insertBefore(new_post, ni.nextSibling);
the code has been shortened to the important bits.