Skip to content
This repository was archived by the owner on Dec 11, 2017. It is now read-only.

Allow specification of different placeholders for different kinds of masks.#182

Closed
jlesueur wants to merge 1 commit intodigitalBush:masterfrom
jlesueur:master
Closed

Allow specification of different placeholders for different kinds of masks.#182
jlesueur wants to merge 1 commit intodigitalBush:masterfrom
jlesueur:master

Conversation

@jlesueur
Copy link

@jlesueur jlesueur commented Oct 7, 2013

Allows this:

$.mask.definitions['d'] = $.mask.definitions['9'];
$.mask.definitions['m'] = $.mask.definitions['9'];
$.mask.definitions['y'] = $.mask.definitions['9'];
$.mask.placeholders['d'] = 'd';
$.mask.placeholders['m'] = 'm';
$.mask.placeholders['y'] = 'y';
$('.date-field').mask('mm/dd/yyyy');

Or placeholders can be specified using the options parameter.

also adds a class "placeholder" when the element is empty.

There's some whitespace changes that I can remove if it bothers you, and there may be better things to do than add a placeholder class when empty (such as trigger("mask:empty")). But I think the placeholder implementation is solid. I can also split the changes up if you prefer.

…mask.

Allows this:
$.mask.definitions['d'] = $.mask.definitions['9'];
$.mask.definitions['m'] = $.mask.definitions['9'];
$.mask.definitions['y'] = $.mask.definitions['9'];
$.mask.placeholders['d'] = 'd';
$.mask.placeholders['m'] = 'm';
$.mask.placeholders['y'] = 'y';
$('.date-field').mask('mm/dd/yyyy');

also adds a class "placeholder" when the element is empty
@digitalBush
Copy link
Owner

At some point I'd like to do groups like mm where masks can define validation and control the caret and value. For instance, user types 9, I can set value to 09 and move caret to position after the 9.

I'm not sure this gets me to that goal.

@digitalBush digitalBush removed this from the 2.0 milestone Oct 17, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants