Alex Rivera | Logout

jquery selector to get all select dropdowns with a particular value selected

Asked 2011-03-01T06:00:44.297
25

How do I select all the select boxes using a jQuery selector where value selected is "A1"?

Sample select box:

<select name="accesslevel">
<option value="A1">A1 Access</option>
<option value="A2">A2 Access</option>
</select>

I have to use the selector to do the following thing:

.parent().nextAll('td[id^="A1Access"]').show();
.parent().nextAll('td[id^="A2Access"]').hide();

Can anyone help?

Edit
Report

1 Answer

24

Try :

$('select option[value="A1"]:selected')
answered 2011-03-01T06:14:43.803

Your Answer