Skip to content

Instantly share code, notes, and snippets.

@jupegarnica
Last active December 11, 2015 07:49
Show Gist options
  • Save jupegarnica/4569378 to your computer and use it in GitHub Desktop.
Save jupegarnica/4569378 to your computer and use it in GitHub Desktop.
typewatch event listener with delay
<script src="js/jquery.typewatch.js" type="text/javascript" charset="utf-8" async defer></script>
// callback: The function to call
// wait: The number of milliseconds to wait after the the last key press before firing the callback
// highlight: Highlights the element when it receives focus
// captureLength: Minimum # of characters necessary to fire the callback
var options = {
callback:function(){ alert("changed search text"); },
wait:750,
highlight:true,
captureLength:2
}
$("#search").typeWatch( options );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment