OK,我有一些HTML這樣的:jQuery的nextUntil
<form>
<h3>
<table>
<h3>
<table>
<h3>
<table>
<h3>
<table>
<table>
<input name=action>
</form>
我開始使用.next()
因爲每個H3後只有一個元素是,但最後一節有兩個表。
我試着使用:
jQuery(this).nextUntil('h3, input[name="action"]').detach();
此代碼基本上創建標籤所以每個「本」是每個H3則內容是H3,直到enxt一個後一切。
我只需要弄清楚如何抓住最後一張桌子。
在最壞的情況下,可以前'input'添加一個隱藏的'h3'。 – 2012-02-21 17:14:20