0

I am using masked input 1.2.2 Jquery plugin from digitalbush.com.I want to have the first three digits of a telephone no to be fixed ie. 679-###-####.So my masked input is '679-###-####'.Problem I am facing is when I have the focus on the text-box where I enter the telephone no and submit the form the no 679 is getting appended like 679-679- .Please help. Thanks, Raj

This is my function that calls the .mask of masked input plugin:

function Extend_Fiji_Phone() {
 $("input[type='text'][sfwExtendPhone='true']") .mask('679-###-####') .blur(function (e) { }); } 

Below is my mask definition:

 $.mask = {
 //Predefined character definitions definitions: 

{ '#': "[0-9]", 'a': "[A-Za-z]", '*': "[A-Za-z0-9]" } }

I also tried using the version 1.3.1 of Masked input,In this case the values entered into the text box gets cleared on form submit when the total no of characters entered is less than 10 along with the three fixed characters.When all characters are entered then on form submit the three characters after the fixed three characters ie. '679' get replaced by '679'. So if I have entered 679-123-4843 then on form submit it changes to 679-679-4843 and on next submit changes to 679-679-6793.

Raj
  • 1
  • 2
  • It would be better if you can provide the part of the code you are mentioning here. – Stuart Jan 24 '14 at 07:16
  • please update the code in question,do not post as comment – Cris Jan 24 '14 at 07:33
  • Updated the question with the code and examples.Deleted the code which I had posted in the comments section by mistake.Thanks Jaun and Cris. – Raj Jan 24 '14 at 09:36
  • You must clear the old value each time you do the mask, I have the following for example: `$numberInput.val('').mask("(+" + countryPrefix + ") ---? -- -- -- --");` – SerCrAsH Oct 05 '15 at 07:20

0 Answers0