akzhan / jquery-keyfilter

This plugin filters keyboard input by specified regular expression.
http://akzhan.github.com/jquery-keyfilter/
37 stars 11 forks source link

Best way to access default regexes? #5

Closed nathanl closed 12 years ago

nathanl commented 12 years ago

Not an issue; just a question, maybe leading to a documentation patch.

Your default regexes meet my immediate needs, but I want to use different classes with them.

For instance, I don't want to use class="mask-num" because I'm also using a jquery plugin called 'MaskedInput', so this class name might create confusion on my team.

Instead, I'm doing this:

$('input.integer').keyfilter($.fn.keyfilter.defaults.masks.int)

My question is: is $.fn.keyfilter.defaults.masks.int the best way to access the default regexes?

akzhan commented 12 years ago

Yes, plugin itself uses it.

akzhan commented 12 years ago

You can fully override masks by simple assignment

$.fn.keyfilter.defaults.masks = { ... };

after loading of plugin but before firing of document.ready event.

nathanl commented 12 years ago

Thanks for the info!