[SalesForce] maxlength attribute not working in lightning:input for number type

maxlength attribute in is not working.
Is there any alternative ways for this isuue or any suggestion?

Reffrence: https://developer.salesforce.com/docs/component-library/bundle/lightning:input/example#lightningcomponentdemo:exampleInputNumber

Best Answer

You could specify a minimum and maximum value. It won't prevent input values outside the range, but will highlight it with a red error message:

<lightning:input label="Some Field" max="9999" min="0" />

Be sure to check validity before saving if you use this technique.

Related Topic