Call a function when a user has changed the text within a textbox and after the user has stopped typing. Applies to any input textbox or textarea.
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 textbox continues to have focus.
This can be used in conjunction with an AutoComplete box, so instead of firing an AJAX call every 500 ms, you can fire it once when they’ve stopped typing.
Example:
var options = { callback:function(){ alert("changed search text"); }, wait:750, // milliseconds highlight:true, // highlight text on focus enterkey:true, // allow "Enter" to submit data on INPUTs } $("#search").typeWatch( options );
Also works with multiple elements:
$(".textbox").typeWatch( options );