[TypeWatch] jQuery Plugin to Determine When a User Stops Typing in a Text Field

TypeWatch calls a function when a user types text in the input, a text area, and div changes from editors (including HTML 5 input types) after the user has stopped typing for a specified period of time.

Note * This is not an OnChange event, instead, the function is called after the user has finished typing (or if the user has stopped typing for #ms) even if the focus remains on the input.

This can be used in conjunction with an autocomplete implementation, so instead of firing an AJAX call every 500 milliseconds, you can fire it once when they stop typing.

HTML 5 is now supported in the input event for browsers that support it.

How to make use of it:

1. First you must load the jQuery type watch plugin after the jQuery JavaScript library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/jquery.typewatch.js"></script>

2. Call the perform on the text fields and specify the motion after the user has stopped typing.

$('input,textarea').typeWatch({
  callback: function(value) {
    // do something
  }
});

3. Config the plugin to set off the function after a timeout.

$('input,textarea').typeWatch({
  wait: 750, // 750ms
  callback: function(value) {
    // do something
  }
});

4. Highlights the component when it receives focus.

$('input,textarea').typeWatch({
  wait: 750, // 750ms
  highlight: true,
  callback: function(value) {
    // do something
  }
});

5. Specify the minimal # of characters essential to trigger the function.

$('input,textarea').typeWatch({
  wait: 750, // 750ms
  highlight: true,
  captureLength: 2
  callback: function(value) {
    // do something
  }
});

Run A Function When User Stops Typing, TypeWatch jQuery plugin/Github, jquery debounce keyup, jquery keyup after 2 seconds


See Demo And Download

Official Website(dennyferra): Click Here

This superior jQuery/javascript plugin is developed by dennyferra. For extra Advanced Usage, please go to the official website.

Share