How to set the selected value of a dropdownlist to the selected value of another?
The below code shows how to accomplish this correctly.
ASPX
<asp:DropDownList ID="ddl1" RunAt="Server" DataValueField="ID" DataTextField="ID" AppendDataBoundItems="true"/>
<asp:DropDownList ID="ddl2" RunAt="Server" DataValueField="ID" DataTextField="TEXT" AppendDataBoundItems="true"/>
JQUERY
$("#<%= ddl1.ClientID %>").change(function() {
var Code = $(this).val();
$("#<%= ddl2.ClientID %>").val(Code);
});
When using jQuery Mobile, however the DataTextField is rendered as a span tag which the above code does not update.
QUESTION
How to amend the above code to accommodate for this?