I was wondering if anyone could advise me a little. I am attempting to use JQuery to select my dropdown item by a given value. Here is what I have
var myVar = document.getElementById('<%= hiddenID.ClientID %>').value
if (myVar != "") {
var val = $("select[name*=drpDescription] option").filter(function () {
return ($(this).val() == myVar)
});
$("select[name*=drpDescription]").val(val.val());
}
The above code snippet does get the correct option based on it's value matching my hiddenfield value. What I can't do is get my dropdown to display it as the selected item. I wondered if anoyone has any advise on where I am slightly missing the point.
Thank you for any help.