开发者

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

开发者 https://www.devze.com 2023-02-09 12:41 出处:网络
I have: $(document).ready(function () { jQuery(function ($) { $(\"#ClientID\").mask(\"999-999999999\"); }

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

精彩评论

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