开发者

jQuery get by class and attribute

开发者 https://www.devze.com 2023-04-10 12:43 出处:网络
Hi I have a select like: <select id=\"item_OfficeUserId\" class=\"dropdownauditor\" name=\"item.OfficeUserId\" invoicelineid=\"33\">

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


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

Using the attribute equals selector.

0

精彩评论

暂无评论...
验证码 换一张
取 消