From an ajax request i get this response
val1,val2,val3
and have a list with id equivalent to them like
<select multiple>
<option id="val1">val1</option>
<option id="val4">val4</option>
<option id="val5">val5</option>
<option id="val2">val2</option>
<option id="val6">val6</option>
<option id="val1">val3</option>
</select>
how can i give all option ids that are in the ajax response the attr selected? like this:
<select multiple>
<option id="val1" selected="selected">val1</option>
<option id="val4">val4</option>
<option id="val5">val5</option>
<option id="val2" selected="selected">val2</option>
<option id="val6">val6</option>
<option id="val1" selected="selected">val3</option>
</select>
I hope this is clear! many thanks in advance