2011-09-28 44 views
2

这里是我的HTML:在最后一个标签之前追加?

<section> 
    <article></article> 
    <article></article> 
    <!-- INSERT HERE --> 
    <footer></footer> 
</section> 

我怎么会插入最后article后,但在此之前的footer内容?

我试着这样做:

$('<article>Yipee</article>').appendTo('section article:last'); 

但是,插入新article最后一个内,而不是作为同级。

我正在运行jQuery 1.6.2。

回答

5

insertAfter是你正在寻找我的函数想:

$('<article>Yipee</article>').insertAfter('section article:last'); 
相关问题