<div class="selectedColumns" >
<a href="#" attributeid="19" >Driver License State</a>
<a href="#" attributeid="21" >Email</a>
<a href="#" attributeid="23" >Experience Level</a>
<a href="#" attributeid="26" >First Name</a>
<a href="#" attributeid="71" >Is Account Enabled</a>
<a href="#" attributeid="39" >Last Contacted Date</a>
<a href="#" attributeid="40" >Last Name</a>
<a href="#" attributeid="41" >Middle Name</a>
<a href="#" attributeid="6">Carrier</a>
</div>
我有一组链接,每个链接都有一个属性id。我想按属性值进行过滤。因此在上面的链接中,如果我的值为41,则会返回Middle Name链接。
var link = $('.selectedColumns a:[attributeid==' + $(this).val() + ']');
这个没有起作用吗?
data-
开头(例如data-attributeid
),则可以具有有效的自定义属性。这些在早期版本中仍然无效,但是嘿,您当前的版本也是如此。 :-) - T.J. Crowder