Here's my HTML:
<section>
<article></article>
<article></article>
<!-- INSERT HERE -->
<footer></footer>
</section>
How would I insert content after the last article
but before the footer
?
I've tried doing this:
$('<article>Yipee</article>').appendTo('section 开发者_StackOverflow中文版article:last');
But that inserts the new article
inside the last one instead of as a sibling.
I'm running jQuery 1.6.2.
insertAfter is the function your are looking for I think:
$('<article>Yipee</article>').insertAfter('section article:last');
精彩评论