Karthik N Karthik N - 10 months ago 44
CSS Question

find attr which has class "select"

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


<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>


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

I hope it's not work.

Answer Source

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

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