【发布时间】:2014-08-11 10:06:28
【问题描述】:
我想使用 html 助手 (TextBoxFor) 屏蔽电话号码
这是我的代码
Model :
[Required(ErrorMessageResourceType =
typeof(ProcRec.Ressources.Candidat.ErreurValidation),
ErrorMessageResourceName = "num_tel_obligatoire")]
[RegularExpression(@"[0][6]\-\d{2}\-\d{2}\-\d{2}\-\d{2}$",
ErrorMessageResourceType =
typeof(ProcRec.Ressources.Candidat.ErreurValidation),
ErrorMessageResourceName = "num_tel_faux")]
public string num_tel { set; get; }
查看:
<script type="text/javascript">
jQuery(function($){
$("#date").mask("99/99/9999");
$("#num_tel").mask("(999) 999-9999");
$("#tin").mask("99-9999999");
$("#ssn").mask("999-99-9999");
});
</script>
<td>@Html.LabelFor(model => model.num_tel)</td>
<td>@Html.TextBoxFor(model => model.num_tel)</td>
验证正常
但说到面具,我什么也得不到
他们是我得到的结果
。 . . . . . .
【问题讨论】:
-
我试过了,但它不能用 textboxfor... 我想我错过了什么,但我不知道在哪里
-
您是否遇到任何控制台错误?
-
尝试将javascript代码放入
$(document).ready(function(){/* put here */}); -
jQuery(function($){ ....});应该像(function($){...})(jQuery);... 我不确定,但我看到了 this 链接。
标签: javascript jquery asp.net-mvc jquery-mask