I have a div with 4 seperate lists, I need to know the id of the list before the one i click on.
So lets say i click on ul2 i need an alert of ul1 id.
currently im getting the clicked id with:
var clicked_id = this.id;
and ive tried the following to get the above ul
var div_id2 = $(this).parents(".divtest").next(".ultest").attr("id");
var div_id = $(this).closest('ul').find('.ultest').attr('id');
var x = $(this).prev().attr('id');
simplification of layout:
<div id="doesnt matter" class="divtest">
<ul id="ul1" class="ultest">
<li id="doesnt matter"></li>
<li></li>
<li></li>
</ul>
<ul id="ul2" class="ultest">
<li></li>
<li></li>
<li></li>
</ul>
<ul id="ul3" class="ultest">
<li></li>
<li></li>
<li></li>
</ul>
<ul id="ul4" class="ultest">
<li></li>
<li></li>
<li></li>
</ul>
</div>