Created
March 8, 2018 11:58
-
-
Save DominikStyp/dd46e65408b08a71fb31ba0a2b5f132c to your computer and use it in GitHub Desktop.
Trigger form input change event after timeout (when user stops writing in the field for X miliseconds)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document._keyPushTimeoutId = 0; | |
$(document).on('keyup', 'input.form-control', function(){ | |
var element = $(this); | |
window.clearTimeout(document._keyPushTimeoutId); | |
document._keyPushTimeoutId = setTimeout(function(){ | |
element.change(); | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment