Hello
I'm trying to change a mask from a field on my form. Below in the field highlighted in blue, it is as it currently is, and in the second field it is how I want it to be (without the space between )
and 1
). I want to change this because by allowing the data to be sent in the first way, I have some problems returning bank results.
BelowistheJavascriptcodethatisdoingthemask.
Ihavetriedtoremovethespaceafter)
onlinetexto=[texto.slice(0,3),") "
but I had problems with the field operation.
$("#txtTelefone2").bind('input propertychange', function () {
var texto = $(this).val();
texto = texto.replace(/[^\d]/g, '');
if (texto.length > 0) {
texto = "(" + texto;
if (texto.length > 3) {
texto = [texto.slice(0, 3), ") ", texto.slice(3)].join('');
}
if (texto.length > 12) {
if (texto.length > 13)
texto = [texto.slice(0, 10), "-", texto.slice(10)].join('');
else
texto = [texto.slice(0, 9), "-", texto.slice(9)].join('');
}
if (texto.length > 15)
texto = texto.substr(0, 15);
}
$(this).val(texto);
})
How can I fix this? Thanks!