假設我有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