How to get ul class name while clicking li – jquery
<div class="div-class-parent">
<div class="div-class">test</div>
<ul class="tabs">
<li class="node-205"></li>
<li class="node-150"></li>
<li class="node-160"></li>
</ul>
</div>
EDITED:
For example when i clicking the “li” I need to get the class name of ul and class name of the div.
That is i need the class name “tabs” and “div-class”.
When i use the below code i get the parent class name of div that is i get “div-class-parent”.
$('li').click(function() {
alert($(this).closest('div').attr('class'));
});
How can this be done using jquery.
thanks in advance…
Simply reference to the parent:
or find closest element:
EDIT