私は次のようなテーブルを持っています。JQueryの横断テーブルの列
<table>
<tr>
<th scope="col"></th>
<th scope="col">Column One</th>
<th scope="col">Column Two</th>
<th scope="col">Column Three</th>
<th scope="col">Column Four</th>
</tr>
<tr>
<th scope="row">Row One</th>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th scope="row">Row Two</th>
<td></td>
<td></td>
<td class="click"></td>
<td></td>
</tr>
<tr>
<th scope="row">Row Three</th>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th>Row Four</th>
<td></td>
<td></td>
<td class="target"></td>
<td></td>
</tr>
<table>
私は「クリック」のクラスに<td>
をクリックし、ターゲットのクラスと<td>
がどのように多くの行を離れてのように私を警告できるようにしたいと思います。 (上記の例では2を返します)。
他の<td>
要素がターゲットのクラスを持つテーブルに存在することがあります。私はの次ののターゲットと同じ行にある「クリックされた」td
までの行数にのみ興味があります。 「クリックされた」<td>
以上のターゲットは無視する必要があります。
同じ行のクリックされた要素の後に他の 'ターゲット' <td>
がない場合、アラートには「他のターゲットはありません」と表示されます。
これは明らかです。
あなたの質問は何ですか?あなたはすでに自分で何をしていますか? –