Open lakipolitis opened 7 years ago
As a note, I forgot to attach the change trigger and wasn't getting PostBack values in ASP.net. So I added it back and everything worked perfectly. Code now looks like this:
var v = this.map[val];
this.$source.children().each(function () {
if ($(this).val() == v) {
$(this).attr('selected', 'selected');
}
});
this.$source.trigger('change');
I was experiencing an issue where the jQuery
this.$source.val(this.map[val]).trigger('change');
was not forcing the select to actually highlight the option as selected. I noticed it on the demo as well. I'm using Chrome 57.0.2987.133
I changed that line of code (not nearly as clean as yours) to this:
And it's working nicely.