Skip to content

mattfreer/InputRestrictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Description:
A JavaScript Trait which can be used to apply char restrictions on a Form Input (text) element.

Dependencies:
underscore.js: http://documentcloud.github.com/underscore/
traits.js : http://traitsjs.org/

Usage:
var restrictor = Trait.create(this, new TInputRestrictor())
restrictor.restrict($('#decimal_txt'), /[0-9.\-]/, /^-{0,1}\d*[.]?\d{0,2}$/);

Example of use in a Backbone View:
http://jsfiddle.net/mattfreer/5SFpG/

About

InputRestrictor.js

Resources

Stars

Watchers

Forks

Packages

No packages published