I have a masked input text box which will take id and amount. But if the user enter only amount and come out of the text box the value is getting changed. Below is the code and example.
我有一个蒙面输入文本框,它将占用id和数量。但是,如果用户仅输入金额并从文本框中退出,则值会发生变化。下面是代码和示例。
<label>Phone Number</label>
<input id="phone" type="text" value="" />
jQuery(function($) {
$("#phone").mask("?a-9999 $99999.99");
});
The out put of the masking will be A-1234 $12345.00
if the user enter the amount like A-1___ $12345.67
and comes out, the value became A-1123 $4567_.67
. We want the value to saty as the user entered. Please help me to solve this issue. Thanks in Advance.
如果用户输入A-1 ___ $ 12345.67这样的金额并且出来,那么掩蔽的输出将是A-1234 $ 12345.00,该值变为A-1123 $ 4567_.67。我们希望用户输入时该值为saty。请帮我解决这个问题。提前致谢。
1 个解决方案
#1
There are many masked input plugins for jQuery, and I didn't got which one you are using from the question.
jQuery有很多蒙面的输入插件,我没有从问题中得到你使用的那个。
I would suggest to just pick a better one here: https://plugins.jquery.com/tag/mask/
我建议你在这里选择一个更好的:https://plugins.jquery.com/tag/mask/
You may want to use this one http://robinherbots.github.io/jquery.inputmask/
您可能想要使用这个http://robinherbots.github.io/jquery.inputmask/
I built a jsfiddle here for implementing the same function:
我在这里构建了一个jsfiddle来实现相同的功能:
jQuery(function($) {
$("#phone").inputmask("a|A-9999 $99999.99");
});
#1
There are many masked input plugins for jQuery, and I didn't got which one you are using from the question.
jQuery有很多蒙面的输入插件,我没有从问题中得到你使用的那个。
I would suggest to just pick a better one here: https://plugins.jquery.com/tag/mask/
我建议你在这里选择一个更好的:https://plugins.jquery.com/tag/mask/
You may want to use this one http://robinherbots.github.io/jquery.inputmask/
您可能想要使用这个http://robinherbots.github.io/jquery.inputmask/
I built a jsfiddle here for implementing the same function:
我在这里构建了一个jsfiddle来实现相同的功能:
jQuery(function($) {
$("#phone").inputmask("a|A-9999 $99999.99");
});