JElster
asked on
Jquery - how to set a select value
Hi.. again
I have the following, how can I set the 'selected' value in JQuery... for example I need the selected value to be '1.0'
thx
<select name="errorcodeedit" id="ErrorCodeEdit" style="width: 450px;">
<%
strSql = " SELECT error_code, error_description FROM eps.error_codes order by error_code "
rs3.Open strSql, connection
%>
<option value=''>Select</option>
<%
Do Until rs3.EOF
%>
<option value='<%=rs3.Fields(0).Va lue%>'><%= rs3.Fields (0).Value% > -&n bsp<%=rs3. Fields(1). Value%></o ption>
<%
rs3.movenext
Loop
rs3.close
%>
</select>
I have the following, how can I set the 'selected' value in JQuery... for example I need the selected value to be '1.0'
thx
<select name="errorcodeedit" id="ErrorCodeEdit" style="width: 450px;">
<%
strSql = " SELECT error_code, error_description FROM eps.error_codes order by error_code "
rs3.Open strSql, connection
%>
<option value=''>Select</option>
<%
Do Until rs3.EOF
%>
<option value='<%=rs3.Fields(0).Va
<%
rs3.movenext
Loop
rs3.close
%>
</select>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No problem. I also wanted to mention you could add the selected attribute to the relevant option tag as you were outputting it. It just depends on when you want that option selected.
If it's before the user had interacted with the page then it may be better to put in the selected attribute as you're outputting the code on the server side.
If you're going to bed to select that option because of another action the user does, well it's best left in the JavaScript
If it's before the user had interacted with the page then it may be better to put in the selected attribute as you're outputting the code on the server side.
If you're going to bed to select that option because of another action the user does, well it's best left in the JavaScript
ASKER