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

时间:2021-02-23 17:07:56

I have an issue with Autonumeric plugin:

我有自动数字插件的问题:

Html

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

Javascript

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

I try to type in testInput, but I don't success because vMin is 20.00.

我尝试输入testInput,但我没有成功,因为vMin是20.00。

Example: http://fiddle.jshell.net/gatfil/7h604exp/1/

Autonumeric http://www.decorplanit.com/plugin/

Thank you

1 个解决方案

#1


0  

From Autonumeric plugin documentation:

来自Autonumeric插件文档:

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和vMax设置是限制。这意味着用户无法输入大于vMax值的值,也无法输入或删除vMin设置以下的值。将vMin和vMax值设置为正值或负值时,可能会产生一种自相矛盾的情况,这会限制用户输入值的能力。考虑以下:

...

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

vMin:'10'和vMax:'100'并且没有默认值 - 您永远不能输入任何值。

So If the minimum / maximum values are both positive or negative you MUST have a default value assigned to the field and you're in the sample situation vMin:'10' & vMax:'100' and no default value - you can never enter any value.

因此,如果最小值/最大值都是正数或负数,则必须为该字段分配一个默认值,并且您处于示例情况vMin:'10'和vMax:'100'并且没有默认值 - 您永远不能输入任何价值。

So the solution is to set the vMin value as default value for you input:

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

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

Check your updated jsfiddle

检查更新的jsfiddle

Hope it helps,

希望能帮助到你,

#1


0  

From Autonumeric plugin documentation:

来自Autonumeric插件文档:

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和vMax设置是限制。这意味着用户无法输入大于vMax值的值,也无法输入或删除vMin设置以下的值。将vMin和vMax值设置为正值或负值时,可能会产生一种自相矛盾的情况,这会限制用户输入值的能力。考虑以下:

...

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

vMin:'10'和vMax:'100'并且没有默认值 - 您永远不能输入任何值。

So If the minimum / maximum values are both positive or negative you MUST have a default value assigned to the field and you're in the sample situation vMin:'10' & vMax:'100' and no default value - you can never enter any value.

因此,如果最小值/最大值都是正数或负数,则必须为该字段分配一个默认值,并且您处于示例情况vMin:'10'和vMax:'100'并且没有默认值 - 您永远不能输入任何价值。

So the solution is to set the vMin value as default value for you input:

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

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

Check your updated jsfiddle

检查更新的jsfiddle

Hope it helps,

希望能帮助到你,