var customOptions = {
onKeyPress: function(val, e, field, options) {
if (val.replace(/\D/g, '').length===2)
{
val = val.replace('8','');
field.val(val);
}
field.mask("+7 (999) 999-99-99", options);
},
placeholder: "+7 (___) ___-__-__"
};
$("input[name='phone']").mask("+7 (999) 999-99-99", customOptions);
<rect x="50" y="20" rx="150" ry="150" width="150" height="150" style="fill:red;stroke:black;stroke-width:9;opacity:0.5">