I want to achieve going to the parent element then to the prev element get the atrribute id of the element which has class: classname.
<div>
<span><span id="190" class="classname">blabla</span></span>
<span><a href="#" class="button">blabla</a></span>
</div>
Pseudo code:
$('.button').click(function(){
console.log($(this).parent().prev().$(".classname").attr("id"));
});
Do I have to use a find here or is there another way?