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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -