JQuery Simultaneous Event Problem
Example resolve problem with JQuery when two events fired simultaneously.
by amitrdx
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css">
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile.theme-1.1.0.min.css">
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile.structure-1.1.0.min.css">
<input type="text" id="text1">
<br/>
<input type="text" id="text2">
<input type="button" id="btn" value="compare">
JavaScript
var clickwithblur = false;
$("#btn").click(function() {
alert("click")
}).mousedown(function() {
clickwithblur = true;
})
$("#text1").blur(function() {
alert("blur")
if (clickwithblur) {
alert('if');
$("#btn").click()
}
})