开发者

Jquery mask not working on a field which is disabled and then enabled

I have:

$(document).ready(function () {
    jQuery(function ($) {
        $("#ClientID").mask("999-999999999");
    }
}

Now this mask works fine in the Textbox when the textbox is enabled. Sometimes though when the page loads we have this field as disabled, and there is unlock checkbox, which enables that field. The problem is when we enable this field, then the mask does not appear.

There is开发者_Go百科 a chance that something else other than the disable/enable might be the problem but I haven't figure it out yet.

Any suggestions?


All is fine when I test the below code.

$(document).ready(function () {
        $("#ClientID").mask("999-999999999");
});

The test box is cleared only when at the time of disabling if the input doesn't match the mask, then the input gets vanished

Masked input version used: 1.2.2
Check out this fiddle.

On an unrelated side note dont use

$(document).ready(function () {
    jQuery(function ($) {

    });
});

Because jQuery(function ($) is the shortcut for $(document).ready(function ()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜