Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DominikStyp/dd46e65408b08a71fb31ba0a2b5f132c to your computer and use it in GitHub Desktop.
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)
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