Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate data mask

I have a problem to validate data- mask.

<strike><input type="text" data-mask="a-99999999-9"></strike>

I need you where going "a" only become available the letters " VEJPG ".

if anyone knows how it could do so thanks.

like image 308
carlos espinoza Avatar asked Nov 01 '22 05:11

carlos espinoza


1 Answers

JQuery Mask plugin doesn't recognize "a" in the mask expression, it supports "A" This will work:

<strike><input type="text" data-mask="A-99999999-9"></strike>

If you want the first letter to only V or E or J or P or G then you have to call the mask constructor in javascript as follow:

$("#idOfTextInput").mask("v-9999999-9",{translation: {'v':{pattern:/[VEJPG]/}}});
like image 106
Jonathan Larouche Avatar answered Nov 15 '22 04:11

Jonathan Larouche