Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove literals from input mask after form submit?

Tags:

this question has already been asked but the solutions where not clear.

Im using Josh Bush's MaskedInput plugin for jQuery

What im trying to achieve is:

E.g: a phone input with the mask

    $("#txtPhone").mask("(99)9999-9999"); 

EQUALS: (00)9398-8373

i want it to submit : 0093988373

------ Is it possible to remove the .mask on submit but keep the value?

like image 520
Wednesday Man Avatar asked Oct 21 '11 20:10

Wednesday Man


2 Answers

I think you want to use unmask

$("#myForm").submit(function() {   $("#txtPhone").unmask(); }); 
like image 110
Alex Peattie Avatar answered Sep 30 '22 04:09

Alex Peattie


Set removeMaskOnSubmit as true when you initialize the inputmask

    $("#txtPhone").inputmask({removeMaskOnSubmit: true}); 
like image 31
Shameem Ahmed Mulla Avatar answered Sep 30 '22 05:09

Shameem Ahmed Mulla