Reputation: 7035
In the below code I am binding the change event to a HTML select and then trying to set its selected value. However, my change event is not called when I select the value of the HTML select via jQuery with the following code:
row.find(".js-sAttribute").change(function ()
{
alert('1');
});
//**the following should trigger change event binded in the above code**
row.find(".js-sAttribute").each(function() { this.selected = (this.text == sAttEnum.ProductID); });
Please advise.
Upvotes: 0
Views: 768
Reputation: 35864
I believe what you need to do is call change() with no arguments after you change the selection manually. Otherwise, it won't actually trigger the change event...
row.find(".js-sAttribute").each(function() {
this.selected = (this.text == sAttEnum.ProductID);
$(this).change();
});
Upvotes: 1