$.charLimit Plugin

Purpose:

Outputs number of characters remaining when typing in an element. Optionally imposes a restriction on number of characters the element can contain.

Defaults

140 characters left

Limit passed in, no threshold

30 characters left

Limit and threshold passed

Note that using a maxlength attribute on your inputs will enforce the limit restriction.

30 characters left

Custom getCounter and counterFormat methods

getCounter looks for a mark element within the closest dl to the element you've called it on. You can override this by passing a method that returns the jQuery object you wish to update. The counterFormat method receives a count number as the argument, and expects a return of the string to be output in the $counter object.

30 characters available, 30 remaining.

The class names applied for warning and exceeded can also be overridden by passing in a classes object:

classes: {
  exceeded: "exceeded",
  warning: "warn"
}