Can anyone please help me to understand why I'm getting multiple alerts when I'm typing 3 to 4 characters simultaneously?
I'm trying to display an alert when the user has stopped typing for 250ms
Jquery code:
var time;
$('#uname').keyup(function() {
clearTimeout(time);
setTimeout(() => {
alert(this.value);
}, 250);
});
I understand that this question can seem to be similar to one of the previous questions, but I have tried that solution, and still not able to understand the error.