I have the following code and this is getting the id attribute of the ‘a’ element. However, I’d like to get the id attribute of the original ‘.panel’ class.
Any ideas how to do this? Thank you!
jQuery:
$('.panel .panel_content a').click(function(){
alert($(this).attr('id'));
});
Markup:
<div class="panel" id="step_2">
<h3>Title</h3>
<div class="panel_content">
<a href="#">Item</a>
</div>
</div>
1 Answer