jQuery掩码不适用于加载的内容 [英] jQuery mask is not working for loaded content

查看:76
本文介绍了jQuery掩码不适用于加载的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当内容加载了ajax时,掩码不能处理输入文本。

when the contents are loaded with ajax, the mask is not working on the input text.

我该怎么办?

感谢

代码:

$.ajax({url: path, data: {action:'create_form_profile'}, timeout:5000, type:"POST", success: function(data) {
    $("#_content").html(data);
    {
        $("#birth_date").mask("9999/99/99");
    }


    $("input:hidden").click(function(event) {
        window.location.href = "logout.php";
        sho‌​w_exit();
    });
}
});


推荐答案

对我来说,这是在ajax回调中运行的:

For me works this in ajax callback:

$('.phone').unmask().mask(phoneMask);

我不明白为什么第二次添加相同的面具会禁用它..

I don't understand why adding the same mask second time disables it..

这篇关于jQuery掩码不适用于加载的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆