1
I have the following HTML code:
<input type="text" id="esc" />
<input type="button" value="Ok" id="ok" />
And jquery/javascript:
$(document).on("change", "#esc", function(){
alert("esc");
});
$(document).on("click", "#ok", function(){
alert("ok");
});
When I type a text in a textbox and right click on Ok it does not execute the code within the click function. Only the code of the change function.
Follow me on the fiddle: http://jsfiddle.net/8389g5rj/1/
What is the reason for this and how can I resolve this "conflict" ?
So if I don’t have any Alert in my actual code this problem won’t occur? I didn’t get the preemptive definition
– Joao Paulo
@Joaopaulo If you have nothing to "interrupt" the next event. Why Alert is called, it depends on a user action and it is preemptive, in other words for the browser an Alert is more important than the next event (for example). Simply without the Alerts your event will be shot normally.
– Erick Gallani
Interestingly, I wasn’t aware of that kind of behavior!
– Joao Paulo
See my latest issue where I try to explain better.
– Erick Gallani