How to limit maximum number of characters that can be typed into ui:inputText and other input fields in Lightning Components?

How to limit maximum number of characters that can be typed into ui:inputText and other input fields in Lightning Components?

Use maxLength attribute to limit maximum number of characters that can be typed into ui:inputText and other input fields in Lightning Components.

Example:
<ui:inputText value=”{!obj.Number__c}” maxlength=”8″/>

In the above example, the maximum number of characters that can be entered is 8.

Leave a Reply