Text Limit | JavaScriptSource

Text Limit

JavaScriptSource Staff May 21, 2008


This script will only allow a set number of characters to be entered into a text field and then focus on the next element. Easy to implement.

This form is formatted for a social security number (XXX-XX-XXXX).


The limit for each individual field is passed to the function by the appropriate input event, as shown in the form using the format: onKeyUp="advance2('currentField','nextField',limit)"

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: textLimit.js


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response