2
我想包裝一個<div>
從<H2>
開始直到下一個<H2>
,但它只是從第一段開始。jQuery從H2中包裝一個div直到最後一段
這是我,幾乎做工作:
$('h2:contains("test")').nextUntil('h2').wrapAll('<div class="wrapper" />');
這裏是我的HTML:
/* from here */
<h2 class='test'>Include this in the wrap</h2>
<p>this</p>
<p>and this</p>
<p>and this</p> /* to here */
<h2 class='next'>before this</h2>
大,那有用 - 謝謝! – SparrwHawk
@ SparrwHawk - David Eddings!啊!無論如何,沒問題,任何時候:) – karim79
David Eddings?你不是指烏爾蘇拉勒吉恩嗎? :-P – SparrwHawk