$("input").inputmask({
greedy: false,
mask: function (a) {
var mask = '+7(###)###-##-##';
var longSpace = String.fromCharCode(0x2000);
return '' + mask + '[;' + longSpace + '' + mask + '][;' + longSpace + '' + mask + ']';
},
definitions: {
'#': {
validator: "[0-9]",
cardinality: 1,
definitionSymbol: "*"
},
';': {
validator: "[;,]",
cardinality: 1,
definitionSymbol: ";"
}
},
showMaskOnHover: true,
});
$("document").ready(function(){
$("#send").click(function(e){ // ← тут правим
var send = $("form").serialize();
$.ajax({
url: "test.php",
type: "POST",
data: send,
success: function(data){
console.log(data); // ?????
}
});
e.preventDefault(); // ← и тут добавляем
});
});
function getWidthOfText(txt){
var c=document.createElement('canvas');
var ctx=c.getContext('2d');
ctx.font = '16px arial';
var length = ctx.measureText(txt).width;
return txt + ' ' + Math.round(length);
}