Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get input Value when user end typing

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();
});
like image 494
DatJavascript Avatar asked Mar 25 '26 22:03

DatJavascript


1 Answers

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);
});
like image 101
Sushanth -- Avatar answered Mar 27 '26 11:03

Sushanth --



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!