I wanted to make an input field to react to invalid inputs dynamically in such a way that a popup (with window.alert) will be displayed to inform the players of the invalid input. However, after I close the popup, the very same popup will be displayed twice with very short time interval between. The input can be changed after this though.
How can I solve it? Would there be a way to make sure that the popup is not displayed again for a couple of second?
Relevant code:
$(':input').bind('keypress keydown keyup change',function(){
var weight = parseFloat(String($(':input[name='.concat(n,']')).val()).replace(',', '.'));
if (weight > 100 || weight < 0){
window.alert("Bitte eine Nummer zwischen 0 und 100 eingeben!");
}
});