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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -