📜 ⬆️ ⬇️

Jquery.keyfilter.js plugin

I really like the ability to limit the set of input characters in the input fields using a regular expression.

This functionality exists in Ext.JS, but this framework is somewhat heavyweight for most sites. Therefore, I drew a plugin for jQuery that performs the same functionality.


')
You can use it as in a procedural one:
$(selector).keyfilter(/[0-9]/);
$(selector).keyfilter( function (c ) { return c != 'Z' ; });

* This source code was highlighted with Source Code Highlighter .


so in the markup style:
< input type ="text" class ="mask-email" />

* This source code was highlighted with Source Code Highlighter .


The plugin can be extended by connecting scripts with extensions for $ .fn.keyfilter.defaults.masks.

Download the source .

Demo page

Update February 18, 2009 1:25 PM, based on the recommendation of no_smoking, slightly optimized the work of the plugin.

Update February 19 - May 19, 2009 17:25 Corrected bugs, thanks Gram , svoloshyn , Airs0urce .

Source: https://habr.com/ru/post/52245/


All Articles