In my jQuery script I need for comboboxes :
- On
focus
event, run code in order to get all values before the user changes the value inside this<select>
. - On
change
event, run code depending a json object built duringfocus
event
script
var previousDataObject = [];
$('body').on('focus', "select.my-combobox", function () {
comboboxChangeInit(); // it fills previousDataObject up;
}).on( "change", "select.my-combobox", function(){
//here code using previousDataObject
});
The basic jQuery behaviour will run focus
and change
on user actions.
In my case, I need to wait comboboxChangeInit()
fills previousDataObject up completly to run the code on change
event.
How can I create a kind of listener to do this ?