Character count + input limitation plugin with jQuery

Like most web developers, over the years I’ve managed to amass a decent collection of functions and plugins that form part of my core javascript library for most projects I work on.

After writing character count functionality for several different projects I finally decided to turn it into a convenient reusable plugin.

A couple of things I’ve used this for:

  • Integrating with an bespoke SEO toolkit to prevent users making page titles and meta descriptions too long
  • Limiting customer responses in feedback forms
  • Adding to form sign up validation scripts
  • Validation of field length before submission to a varchar limited field in a database

Features

  • Plugin can be bound to any textbox or textarea
  • Plugin allows for multiple instances on the same page
  • Customise the character limit for each instance independently
  • Choose from either count up or count down
  • Choose from either a hard limit or soft limit (soft limits allow the user to keep typing, but indicate that the limit has been exceeded)
  • Apply custom styles when approaching character limit
  • Customise ‘Characters Remaining’ text
  • Only 2kb compressed

Want to see it in action?
View Example

Download the source
Download

Tweet about this on TwitterShare on Facebook0Share on Google+0Share on LinkedIn0


Leave a reply