Friday, February 27, 2009

set/get selected value from select option / dropdownlist using jquery

Here is an example of how to set/get selected value from select option / dropdownlist using jquery

To get a selected value

var selectedItemText = $('#<%=ddlCurrency.ClientID%>
option:selected').val();


To set an option value to be selected

$('#<%=ddlLocation.ClientID%> option:contains(' + location +
')').attr("selected", true);

No comments: