jquery - How to get the content outside of an element -


below code, goal when user clicks button class named click_me, want alert content inside class named content. i've tried doing:

js:

alert($(this).closest('.content').html());  

but didn't work.

html:

<tr>     <div class="content">hello</div>     <div>         <div>             <ul>                 <li></li>                 <li></li>                 <li></li>             </ul>             <ul>                 <li><input type="button" class="click_me" value="click me"/></li>                 <li></li>             </ul>         </div>     </div> </tr>    

try this:

alert($(this).closest('tr').find('.content').html()); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -