JQuery help needed: Which event fires in combobox

2019-08-18 06:05发布

问题:

I want to restrict the user if they select the language which is already selected by displaying alert msg using JQuery. Is there any event which fires before the change event.

回答1:

What I did in this kind of situation was:

In Change event, compare the existing values with newly selected one. if value is there, I alert the message and reset the combo box to default selection.



回答2:

When you add the new combo box, simply remove the previous combo boxes' values from the new one, then you don't have to test for existing values or call an alert.

The user just has the remaining values to choose from. It's much easier.



回答3:

To answer your question, focusin will fire before the change event.