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
Post a Comment