假设我有div的像附加在另一个DIV一个DIV最后一个div jQuery的前
<div id='main'>
<div id='child'>my static content</div>
</div>
$('#main').append("<div class='mycontent'>I'm new box by append</div>");
or
$('#main').appendTo("<div class='mycontent'>I'm new box by append</div>");
我知道我可以使用的append()和appendTo方法插入到任何主要股利。但我需要知道,我如何插入内容到主div的子div之前。内容将在子div之前被推入主div。请帮助我的概念。
感谢
错误的,因为这会前主,而不是最后一个div之前withing主要 – Gavriel 2012-04-10 11:12:51
添加兴田新的div是的,谢谢修复 – Vytautas 2012-04-10 11:14:01