jQuery Max Length Reference

A jQuery plugin that applies a maximum length to a textarea.

This page provides a documentation reference for working with the plugin v1.0.0. See a demonstration of the max length plugin and download the code from there.

Instance Settings

Customise each targetted input field with the settings below (all are optional):
$(selector).maxlength({max: 400});.

NameTypeDefaultComments
maxnumber200 The maximum number of characters allowed in the textarea.
showFeedbackbooleantrue Set to true to show a countdown of characters used/remaining. Otherwise no feedback is shown.
feedbackTextstring '{r} characters remaining ({m} maximum)' The text to display for feedback to the user. Include substitution points within the text: '{r}' for the number of characters remaining, '{c}' for the number of characters entered, and/or '{m}' for the maximum number of characters allowed.

Functions

SignatureReturnsComments
$.maxlength.setDefaults(settings)MaxLength object Update the default instance settings to use with all max length instances.
$(selector).maxlength('change', settings)jQuery object Update the settings for the max length instance attached to the given textarea(s).
$(selector).maxlength('destroy')jQuery object Remove the max length functionality from the given textarea(s).

Contact Keith Wood at kbwood{at}iinet.com.au with comments or suggestions.