Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A jquery plugin to determine when a user has stopped typing in a text field.
JavaScript
branch: master

README.markdown

The official home for the TypeWatch jQuery plugin.

TypeWatch calls a function when a user has typed text in an input or textarea (including HTML 5 input types) and after the user has stopped typing for a specified amount of time.

Note* This is not the OnChange event, instead the function is called after the user has finished typing (or if the user stopped typing for # amount of milliseconds) even if the input continues to have focus.

This can be used in conjunction with an AutoComplete implementation, so instead of firing an AJAX call every 500 ms, you can fire it once when they’ve stopped typing.

Now supports HTML 5 oninput event for browsers that support it

Example:

// callback: The callback function
// 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 (value) { alert('TypeWatch callback: (' + this.type + ') ' + value); },
    wait: 750,
    highlight: true,
    captureLength: 2
}

$("#search").typeWatch( options );

When working with any element other than TEXTAREA pressing the ENTER key will fire the callback function.

Works with multiple elements:

$(".textbox").typeWatch( options );

Lastly, if you use or enjoy TypeWatch beer donations are always appreciated

Donate a beer, half a beer, or a 6-pack

Something went wrong with that request. Please try again.