任何人都可以提供一个选择器来消除这个可怕的代码块:
// img is the image element...
var descriptionContent = $(".descriptionContent", img.parent("td").parent("tr").next("tr"));
html 看起来像这样:
<table>
<tr>
<td><img /></td>
</tr>
<tr>
<td><div class="descriptionContent" /></td>
</tr>
<!-- Repeat n times -->
</table>
鉴于用户点击了 img,我需要获取下一个(并且只有下一个).descriptionContent
元素。
谢谢,
克