I am familiar with jQuery and am creating a small application in which the red screen moves around the screen, and the user should try to click on it, and when the user makes a window alert(), but the problem is that it alert()continues to appear even after clicking "ok". The only way to stop this is to click OK repeatedly, and in the end he quits.
Here is the code that displays the warning window:
function Animate() {
var _newPosition = GetNewPosition();
div.animate({
top: _newPosition[0],
left: _newPosition[1]
}, function () {
div.on('click', function () {
alert('You clicked the box!');
});
Animate();
});
}
Here is my JSFiddle that reproduces the problem
I initially thought I could solve this by returning falseafter the call alert(), for example:
div.on('click', function () {
alert('You clicked the box!');
return false;
});
But that didn't work either.
, , , , , .