delphi
delphi

Reputation: 11125

Mask and/or format with jQuery?

I'm using the standard digitalBush jquery mask plugin. It seems as though I'm fighting with it.

I simply want an input to have a mask (so it'll allow 1 or 2 digits) and then show the word "months" after.

Ie. user can type 3 months or 13 months. I can't seem to do that. Here's as close as I could come, but if the user types just a single digit, it won't append "months" to it. I am using this in conjunction with an HTML5 placeholder plugin.

$("#months").mask("9?9 months",{placeholder:" "});

Upvotes: 1

Views: 1585

Answers (1)

Sparkup
Sparkup

Reputation: 3754

You'll find what your looking for here : Jquery mask plugin Example:

'm': { //month

"validator": "0[1-9]|1[012]",

"cardinality": 2,

"prevalidator": [{ "validator": "[01]", "cardinality": 1}]

}


$("#month").inputmask("m",{"placeholder" : " "});

Upvotes: 1

Related Questions