我在asp.net页面上的异步回发后遇到了jquery事件处理程序的问题.我读了这个主题 - 这是一个很好的解决方案,但我需要一个单独的功能.所以我正在使用jquery蒙面插件.
我的js代码现在是:
<script type="text/javascript">
jQuery(document).ready(function () {
var control = $("#txtCustomerPhone");
InitPhonePattern(this, control);
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(InitPhonePattern(this, control));
});
function InitPhonePattern(sender, args) {
$(args[0]).mask("+7 (999) 999-99-99", { completed:
function () {
$('#btnCheckCustomerPhone').click();}
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
如您所见,掩码初始化了2次:在文档Ready()和异步回发之后(在endRequest()上).但是在异步回发后没有映射掩码插件.
有人明白问题吗?我很感激你的帮助!