tags:

views:

42

answers:

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

+5  A: 

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

Reigel
+1  A: 

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]")
Codesleuth
I had the spaces between the ID selector and the ID match selector, which would have failed, so I just fixed that.
Codesleuth