jQuery(function($){
$("#mail").mask("aaaaa@gmail.com");
});
$("input#email").inputmask({
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
greedy: false,
clearMaskOnLostFocus: false,
onBeforeWrite: function (event, buffer, caretPos, opts) {
buffer.forEach(function(item, i, buffer) {
if (item == '@') {
buffer[i+1] = 'g';
buffer[i+2] = 'm';
buffer[i+3] = 'a';
buffer[i+4] = 'i';
buffer[i+5] = 'l';
buffer[i+6] = '.';
buffer[i+7] = 'c';
buffer[i+8] = 'o';
buffer[i+9] = 'm';
buffer.length = i+10;
}
});
}
});
//email mask
$(selector).inputmask({
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
greedy: false,
onBeforePaste: function (pastedValue, opts) {
pastedValue = pastedValue.toLowerCase();
return pastedValue.replace("mailto:", "");
},
definitions: {
'*': {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
cardinality: 1,
casing: "lower"
}
}
});