Karthik N Karthik N - 1 month ago 7
CSS Question

find attr which has class "select"

I need javascript to find attr which has classname as "select"

HTML



<div class="tab_container">
<a target="1" class="select">Leave</a>
<a target="2">Permission</a>
<a target="3">OT</a>
<a target="4">Comp-Off</a>
</div>


Javascript/jQuery



$('.tab_container a').hasClass("select").attr('target');


I hope it's not work.

Answer

It seems like you already have loaded jQuery, so do it like this:

$('.tab_container a.select').attr('target');