chugh97
chugh97

Reputation: 9984

JQuery element within a certain div but ending with

<div id="a">
    <select id="ctl100_placeholder1_ctl201_dpReasons"></select>

</div>

<div id="b">
     <select id="ctl100_placeholder2_ctl202_dpReasons"></select>
</div>
<div id="c">
     <select id="ctl100_placeholder3_ctl203_dpReasons"></select>
</div>

I am using asp.net dropdownlist which renders as above and I can get hold of the dropdown list ending with $("[id$=_dpReasons]") but how do I get it with div id ="a" or "b" or "c"

Upvotes: 2

Views: 400

Answers (2)

Codesleuth
Codesleuth

Reputation: 10541

This can probably be shrunk down but this will get you a combined result (see Multiple Selector (jQuery)):

$("#a[id$=_dpReasons],#b[id$=_dpReasons],#c[id$=_dpReasons]")

Upvotes: 1

Reigel Gallarde
Reigel Gallarde

Reputation: 65264

with "a" $("#a [id$=_dpReasons]")
with "b" $("#b [id$=_dpReasons]")
with "c" $("#c [id$=_dpReasons]")

Upvotes: 6

Related Questions