Maybe the eq() selecor would help more (http://docs.jquery.com/
Selectors/eq)
something like:
$("#mylist option:eq(2), #mylist option:eq(0), #mylist option:eq
(4)").attr("selected", "selected");
On Aug 3, 2:51 pm, shaded wrote:
> Not exactly. I guess looping through my string would work. but
Not exactly. I guess looping through my string would work. but its a
multiple select list so .addclass wont work
i tried using
$("#mylist option:contains(3)").attr("selected", "selected");
this compares against the list value, not the id. Is there a way to
compare against the id?
Better yet,
If I understand correctly what you're asking, would a simple if
statement (using OR operators to select 1, 3, or 5) and then using
jQuery's .addClass do the trick?
http://docs.jquery.com/Attributes/addClass#class
complete speculation, but you may also be interested in:
http://docs.jquery.com/Sel
3 matches
Mail list logo