I know only the keyup blur and on input methods but they get the value when user is typing. Is there any method to get the value when user end typing
$("#quick-search-input").on("input", function(){
var searchid = $(this).val().trim();
});
You can use setTimeout to check if the user finishes typing.
You start a timer and clear it every time the user starts typing, if the user stops the method in the timeout will be invoked.
var timer;
$("#quick-search-input").on("keyup", function(){
var searchid = $(this).val().trim();
clearInterval(timer);
timer = setTimeout(function() {
console.log('User finished typing !!');
}, 200);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With