Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73935

Popup is triggered multiple times with short time interval

$
0
0

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!");
  }

});

Viewing all articles
Browse latest Browse all 73935


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>