Vote count:
0
I have a dropdown on an asp.net-mvc page:
<% = Html.DropDownList("PersonId", Model.DevManagers,
new { @id = "PersonId", @class = "searchDropdown" })%>
and I am converting it to use jquery select2 like this
$(".searchDropdown").select2({
width: "500px",
allowClear: true
});
the issue is that if i try then changing the underlying select value like this:
$('#PersonId').val(data.TechOwnerId);
the select2 widget doesn't change the selecteditem.
What is the correct way to update the jquery select2 selected item programmatically?
asked 1 min ago
1 Answer
Vote count:
0
You need to do it like this -
$('#PersonId').select2("val",data.TechOwnerId);
answered 18 secs ago
How we can fetch data from select2 type drop down list using selenium?
RépondreSupprimer