Karthik N Karthik N - 1 year ago 88
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');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download