How to get the first id based the category
<ul>
<li id="1" category="A">One</li>
<li id="2" category="A">Two</li>
<li id="3" category="B">Three</li>
<li id="4" category="B">Four</li>
</ul>
from the above code i can get the first id by
$('ul').find('li:first').attr('id');
Suppose i want to get first id based on category, how to get? In my case i want to get first id of category B.(ans has to be 3)
Try this
Also note that your HTML will not be validated because you are not using default attributes. Instead try using the data-attributes that will validate your Markup..
Check Fiddle