gpt4 book ai didi

javascript - 如何使用 set vMin 在 AutoNumeric 输入中键入值

转载 作者:行者123 更新时间:2023-11-27 22:34:14 26 4
gpt4 key购买 nike

我对 Autonumeric 插件有疑问:

HTML

<input id="testInput" type="text" value="" />

Javascript

//Init Autonumeric
$("#testInput").autoNumeric('init', {
aSep: '.',
aDec: ',',
aForm: true,
vMax: '999999999',
vMin: '20.00'
});

我尝试输入 testInput,但没有成功,因为 vMin20.00

示例:http://fiddle.jshell.net/gatfil/7h604exp/1/

自动数字 http://www.decorplanit.com/plugin/

谢谢

最佳答案

来自Autonumeric plugin documentation:

If the minimum / maximum values are both positive or negative you MUST have a default value assigned to the field that is greater than or equal to the minimum value and less than or equal to the maximum value.

IMPORTANT - please understand that vMin & vMax settings are limits. Meaning the user cannot enter a value greater than the vMax value and cannot enter or delete a value below the vMin setting. When setting the vMin & vMax values to both positive or negative you could create a paradoxical situation which limits the user ability to enter values. Consider the following:

...

vMin:'10' & vMax:'100' and no default value - you can never enter any value.

因此如果最小/最大值均为正值或负值,则您必须为该字段指定默认值,并且您处于示例情况 vMin:'10' & vMax:'100' 并且没有默认值 - 您永远不能输入任何值。

因此解决方案是将 vMin 值设置为您输入的默认值:

<input id="testInput" type="text" value="20" />

检查您更新的jsfiddle

希望对你有帮助

关于javascript - 如何使用 set vMin 在 AutoNumeric 输入中键入值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39287389/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com