Javascript 最近/下一个div选择jquery
我有如下HTML:Javascript 最近/下一个div选择jquery,javascript,jquery,Javascript,Jquery,我有如下HTML: <table> <tr> <td> <button class="popup" id="$row[0]"></button> </td> </tr> </table> <div class="details"> <div id="section-2"> </div> </div> 我想用cl
<table>
<tr>
<td>
<button class="popup" id="$row[0]"></button>
</td>
</tr>
</table>
<div class="details">
<div id="section-2">
</div>
</div>
我想用class details对最近的/下一个div进行对话,
details
元素是表
元素的下一个同级,因此使用查找按钮的表祖先,然后使用查找细节
元素
$(document).ready(function () {
$('.popup').click(function () {
// something like this : $(this).next(".details").dialog('open');
$(this).closest('table').next('.details').dialog('open');
});
});
$(document).ready(function () {
$('.popup').click(function () {
// something like this : $(this).next(".details").dialog('open');
$(this).closest('table').next('.details').dialog('open');
});
});