Monday, 2 September 2013

Setting selected value with JQuery on a select

Setting selected value with JQuery on a select

Is it possible to set the selected option value and keep it sticky if the
values are dynamically generated server-side? I think the answer is yes if
the page doesn't refresh.
I'm currently trying: $('#myselect').val(val); and var val= equates to the
option value which I can see if I alert it. The thing is, this dropdown
forwards the user to another page onchange, so I'm not sure that JQuery
can help me but I thought I'd ask.

No comments:

Post a Comment