Having this sample code:
<input type="text" id="changeid">
<a href="#" id="clickb">click</a>
<script>
$('#clickb').on("click", function(event){
alert(1);
return false;
});
$('#changeid').on("change", function(event){
alert(2);
return false;
});
</script>
When putting something into the text field and click the link immediately, only onchange event fires, but not link click event.
Why is that?
It seems that the change event is blocking the click event?
When you edit the input and then click on the link the following happens on the inside
blureventchangeevent, since it raised ablurand the value changedchangeevent callback opens analert(2)click.The solution is not to use
alert(as xdazz proposed).