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