tags:

views:

30

answers:

2

I am aware that you can use .val() to change which options are selected in a select multiple=multiple but,

How can you simply select/deselect one option, without changing the state of the other options?

A: 

You do not have to use jquery for everything.

var el = $(..)[0];
el.options[i].selected = false;
Alex Reitbort
This doesn't use the *value* to select by, it's an index, and also you used jQuery :)
Nick Craver
+1  A: 

In this case it's easiest to de-select the particular option:

$("#select option[value='"+val+"']").removeAttr("selected");
Nick Craver
thankyou `option[value='"+val+"']` is what i was looking for :)
Hailwood