开发者

jQuery Masked Input Bug

开发者 https://www.devze.com 2023-02-04 01:39 出处:网络
Ok I am using the jQuery masked input plugin version 1.2.2 from DigitalBush. When applying masks such as:

Ok I am using the jQuery masked input plugin version 1.2.2 from DigitalBush.

When applying masks such as:

$(".phone").mask("(999)-999-9999");
$(".zip").mask("99999?-9999");

to text boxes I am getting some strange behavior.

Basically the mask will skip every other space so for a Phone number I will get text that looks like this开发者_开发百科:

(_3_)-3_3-4_4_  

Has anyone else had a similar issue??

here is a sample of the textbox html:

<input id="myZip" class="zip" type="text" maxlength="10"/>

EDIT:

Ok...I am having the issue with jQuery 1.4.3 and 1.4.4(tried both) and i have tested this in IE8 and FireFox.

What I noticed though is this problem only occurs when the textbox in question resides inside of a jQuery-UI modal dialog(other text boxes work fine)...I am using jQuery-UI 1.8.2 and have also tested with 1.8.7 and 1.8.8....I don't know if that will enable anyone to help me solve this or not...

here is how i have everything set up: http://jsfiddle.net/H3hTh/


Ok guys, I found an answer to this. I am now thinking that my problem isnt specifically related to jQuery-UI dialogs, but can happen in other cases.

The solution is to be mindful about when the mask is applied. I was applying my masks on document ready and when the "open" function was called on the dialog, something was messing up the masks.

My solution was to apply the mask on the open event of the modal dialog. Everything works great now.

In general, you just need to be careful about when the masks are applied to the text boxes to avoid interference.


We found this bug while using version 1.2.2 as well, it seems to be fixed in version 1.3.

0

精彩评论

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

关注公众号