Reputation: 341
I created a widget using the example given by jquery on combobox. I am having a hard time designing it so I created/modified the example.
When I change the value using the original control, the change event is working but it is not on the other one. I don't understand why the change event does not trigger on the new control that I created where in fact, it both changes the value itself.
I found out that I can trigger some codes on line autocompleteselect (ln38)
autocompleteselect: function (event, ui) {
ui.item.option.selected = true;
this._trigger("select", event, {
item: ui.item.option
});
// alert('I can put some codes here');
},
But I want to trigger the change event of the selector so that it would be a lot easier for the users to run scripts.
Any idea how to fix this one?
Upvotes: 0
Views: 56
Reputation: 388436
It is because the value of the source element is done programatically using a script which will not fire the change event(it is fired only if the change was done by a user event).
One possible solution is to trigger a change event like
this.element.trigger("change", event, {
item: ui.item.option
});
Demo: Fiddle
Upvotes: 1