3
这是我场面膜:使用jQuery蒙面问题插件
$('#Cellphone').mask("(99)9999-9999?9", { placeholder: " " });
我要清除的面具,当我输入失去了重心。有没有办法做到这一点?类似插件的一个选项...
$('#Cellphone').mask("(99)9999-9999?9", { placeholder: " ", clearOnLostFocus: true });
或成模糊函数:
$('#Cellphone').blur(function() { // clear the mask here. });
我要动态地改变我的面具。我使用这个功能,并且工作得很好...
$('#Cellphone').keyup(function() { var newValue = $(this).val() .replace("(", "") .replace(")", "") .replace(" ", "") .replace("-", "") .replace("?", ""); if (newValue.length > 10) { $(this).mask("(99)9-9999-9999", { placeholder: " " }); } });
但 ...当我按空格键与此字段中选择的内容,我的面具停止工作。任何想法为什么发生这种情况?
谢谢,伙计们!
检查键码是否正常工作。谢谢! – Kiwanax 2013-05-16 12:15:48