Masked Input Plugin 1.2

There is now a new version of my Masked Input Plugin for jQuery. After a long absence with this project, I finally decided to tackle some of the more requested features that have been sent to me. I also did some big reorganization to make room for some future enhancements. With all the changes, it seemed appropriate to bump this version from the 1.1 series.

  • Paste support for more browsers. It should now work in IE7, Firefox 3, Safari, Chrome, and Opera.
  • Fixed backspace bug in Opera.  I had originally put in special handling for Opera to get past a bug that appears to be fixed in current releases.  This code is now removed.
  • Calling .mask() with no arguments will now return the value of the input without the literals.
  • Added option "allowPartial" that will allow partial input to remain when focus is lost.
  • Exposed the hash table of the mask definitions directly to replace the $.mask.addPlaceholder() method.  The old method remains for now, but will be removed in a future relase.  You should now add custom mask definitions by "$.mask.definitions[char]=regex;"
  • Code refactoring and  house cleaning.  I made things more jQuery like and removed some crufty code in the process.  The end result is better organization to build on for future enhancements.
  • Eric

    F1rst!

  • Aaron Chu

    How could I config to include “space” in the masking?

    e.g. A 99999-11
    AA88888-12

    and so on

  • http://teleflow.org Vern Baker

    jQuery(function($){
    $(“#txtCallid”).mask(“(999) 999-9999″);
    });

  • Aaron Chu

    However, the masking place may have the chance to have a character, a space or a number

    mask(“(999) 999-9999″);
    will only accept a space after “)”, & nothing else. Right?

  • Brandon Jones

    Right, that’s all the masking will accept after the parenthesis.

    I actually had a question about how I would go about specifying a specific value range for any particular space. I guess essentially it’s a question of how to self validate within the mask while on input.

    So I could do a time value and make it so only the following was acceptable:
    [0-2][0-9]:[0-6][0-9]

    Or for a date:
    [0-1][0-9]/[0-3][0-9]/[0-9][0-9]?

    Anything you could point me towards or suggest would be much appreciated.

  • ILog

    Hi!

    I’ve just tried setting “allowPartial: true”, and it looks like there is a small bug. I have several inputs on the form with numeric mask and “completed” processing to jump to the next input automatically. One of these inputs was recently requested to keep partially filled. So, when I set “allowPartial” for this one while others remain standard, this “partial” control displayed placeholders not being focused. I had to use spaces for placeholders everywhere.

    I would also vote for “ranges” in mask.

    Thank you for this _excellent_ plugin!

  • ADnan

    Hi – Is there any example on how i can use this with asp.net

  • http://www.kleibernet.de Vortilion

    0 down vote favorite
    share [g+] share [fb] share [tw]

    I want to limit an html input field to an input like

    Name 1 & Name 2,

    so that the user can only type in two names in the format

    e.g. “Steven & Peter” or “Alex & Jennifer”.

    I tried it with jQuery “maskedinput” and

    $(‘.picName’).mask(‘aaaaaaaa & aaaaaaaa’);

    but here the user has to input EXACTLY 8 characters per name, but I want it to set to MAX. 8 characters per name. Does anybody know if that’s possible with maskedinput?