Using JQuery, I have two different events on two different elements, that I want to trigger the same function. Is there some way to combine the two separate statements into one statement -
Example:
$('#element1').on('change', function () {
      myFunction();
});
$('#element2').on('click', function () {
      myFunction();
});
Is there someway to combine these into one statement?
I would like to do something like -
//this does not work
$('#element1','#element2').on('change, click', function () {
      myFunction();
});
NOTE:
- The event 'change' should ONLY apply to '#element1' 
- The event 'click' should ONLY apply to '#element2'. 
- The event 'change' should NOT apply to '#element2' 
- The event 'click' should NOT apply to '#element1'. 
 
    