Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Adds a custom jquery event to input and textarea fields which your widgets can listen for and fire event appropriately

License

Notifications You must be signed in to change notification settings

anotherchrisberry/textentered

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

textentered.js

This plugin is simple. It allows your jquery code to listen for a new event: textentered. This event fires whenever a user pauses in typing.

Simple Usage

The API is fairly simple. To use the plugin out of the box, include the script on your page, then listen for a textentered event:

<script type="text/javascript" src="jquery.textentered.js"></script>  
<script type="text/javascript">  
    $('#filterField').bind('textentered', function() { ...//do stuff });  
</script>

To override the default behavior, pass in a set of parameters:

$('#filterField').textentered({
   trimValue: false, // ignore whitespace when deciding when event is triggered? Default: true  
   idleDelay: 200, // how long to wait between keystrokes before firing; default: 490  
   minLengthToTrigger: 5 // how many characters need to be there before firing; default: 0  
}).bind('textentered', function() { filterResults(); });

Advanced Usage

The API provides a few customizations:

idleDelay: 490, // how long to wait before firing the event  
pasteDelay: 10, // because paste events in Firefox do not register the pasted value immediately, we have to delay it a tiny bit.  
eventsToTrap: 'keyup paste blur change', // events that cause the event to fire  
minLengthToTrigger: 0, // if the length of the entered text is less than this, do not fire the event. Set to 0 to always fire.  
trimValue: true // trim the value for comparison - will prevent firing if user types the space key, but does not actually change the value of the field

About

Adds a custom jquery event to input and textarea fields which your widgets can listen for and fire event appropriately

Resources

License

Stars

Watchers

Forks

Packages

No packages published