I have not found any answer. So asking.
My HTML code
<button id="myButton">Click Me</button>
<select id="mySelect">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
My JS
$("#myButton").on("click", function(){
alert("Hi");
});
$("#mySelect").on("change", function(){
alert("Hi");
});
So in both events my function do the same thing. How can I combine these two events and type my function there? Is it possible?
I heard about trigger. I can use that. But want to know if there is any way to merge these events.