Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery get by class and attribute

Tags:

Hi I have a select like:

<select id="item_OfficeUserId" class="dropdownauditor" name="item.OfficeUserId" invoicelineid="33"> 

In jQuery I can get it by its class:

$(".dropdownauditor") 

Is there a way to get it based on its class and it attribute invoicelineid="33" as well?

There will be more than one with class="dropdownauditor". I want to get the selected item of the particular select. I was using:

$(".dropdownauditor").change(function () {     $(".dropdownauditor option:selected").each(function () {     ...     } } 

But this is running through the second part twice. ie. It tis then finding the selected for every select with class="dropdownauditor" Is is possible to only find only one with invoicelineid="33"?

like image 512
AnonyMouse Avatar asked Oct 05 '11 01:10

AnonyMouse


1 Answers

$(".dropdownauditor[invoicelineid='33']") 

Using the attribute equals selector.

like image 112
Andrew Whitaker Avatar answered Sep 22 '22 21:09

Andrew Whitaker