Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

jQuery Masked input plugin formatting

Hi experts,

I'm using the jQuery Masked input plugin.

Example 1

In this example i'm masking a textbox to social security number format and not allowing all zeros to be entered.

http://jsfiddle.net/bc5zsryv/2/

so in this example this is how that is being done:

$.mask.definitions['^']='[123456789]';
$("#ssn").mask("^99-99-9999");

So this example works just fine.


Example 2

I'm doing another example that works exactly the same as example 1.
In example 2 though, the mask argument is a variable which I'm filling the value with a for loop.

If my .mask argument is a variable like shown below how would I add the ^ to the variable to it knows not to allow zeros.

I tried this but I know that's not the correct syntax.
Anyone know the correct syntax?

$.mask.definitions['^']='[123456789]';
$('#MyTextBox').mask( ^mask.mask); // set textbox mask
ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial