limitVal()

$(selector).limitVal(maxLength)

Description

Limits the number of characters a user can type into an <input> element in real-time.

Example

<input id="username" />
$('#username').limitVal(5);

💡 Now the user cannot type more than 5 characters.

Last updated