A jQuery plugin for producing a twitter-like countdown of characters remaining for length-limited form fields.
max_chars
: The max number of characters allowed in the field. Default: The field'smaxlength
attribute if available, or 500 if nomaxlength
.low_chars
: The number of characters remaining that will trigger the addition of the "low_class" parameter as a class name on the character count. Default:10
allow_overrun
: Boolean parameter indicating whether the user is allowed to exceedmax_chars
, pushing the counter into the negative. Default:false
low_class
: The class name added to the character count once the number of characters remaining reacheslow_chars
. Default:"low"
field_class:
The class name added to fields using this plugin as a hook to any related styles you want to apply. Default:"has-counter"
counter_class
: The class name of the<label>
element that contains the countdown of remaining characters. Default:"char-counter"
counter_message
: The text that precedes and explains the numerical countdown. Default:"Characters remaining: "
counter_location
: Where you want the countdown to appear. Accepts"before"
(puts the countdown immediately before the field in the DOM tree),"after"
(like"before"
only... after-er), or a jQuery selector (appends the countdown to the selector's target(s)). Default:"after"