The input maxlength attribute

The maxlength attribute specifies the maximum number of characters allowed in an input field: