javascript - closest/next div selecting jquery -
i have html this:
<table> <tr> <td> <button class="popup" id="$row[0]"></button> </td> </tr> </table> <div class="details"> <div id="section-2"> </div> </div>
here goes jquery script:
$(document).ready(function() { $('.popup').click(function () { // : $(this).next(".details").dialog('open'); $('.details').dialog('open'); }); }); });
i want dialog closest/next div class details
the details
element next sibling of table
element, use .closest() find table ancestor of button
use .next() find details
element
$(document).ready(function () { $('.popup').click(function () { // : $(this).next(".details").dialog('open'); $(this).closest('table').next('.details').dialog('open'); }); });
Comments
Post a Comment