9,094 views
Bookmark and Share

jMaxInput: jQuery Twitter-Like Textarea

November 8, 2009 | by cody | jQuery | 21 Comments

jMaxInput

jMaxInput allows you to limit the input size of a textarea like it is done in Twitter. The number of characters left to type are shown while typing. The user can write as many characters as he wants (negative value is shown) but the text can only be submitted if the size of the input is below the limit (the button is active/inactive).

You can call it like this:

$("#div").maxinput();

You can as well define the following properties:

  1. limit: The maximum number of characters allowed
  2. position: The position of the message
  3. showtext: Boolean for showing the text message or just the number of characters left
  4. message: A custom message shown after the number of characters left

View demoDownload jMaxInput

Tagged with: , , ,

Related Posts

Comments (21)

  1. Social comments and analytics for this post…

    This post was mentioned on Twitter by codrops: jMaxInput: jQuery Twitter-Like Textarea – http://bit.ly/2wk4wG…

  2. jQuery Blog says:

    Hey.. Nice article..
    I would like to share a similar tutorial: Maxlength Textarea using jQuery

  3. forex robot says:

    great post as usual .. thanks .. you just gave me a few more ideas to play with

  4. axe says:

    doesn’t work correctly. I can still copy/paste characters over the limit.

  5. [...] In: JQuery plugins 21 Dec 2009 Go to Source [...]

  6. [...] jMaxInput – jQuery Twitter-like textarea – Link. [...]

  7. awesome article. I’m definitely looking forward to reading more posts!

  8. Cesar says:

    It doesn’t work, if I leave a key pressed I can submit the form, try it in the example, just leave a key pressed so it writes something like ‘aaaaaaaaaaaaaaaaaa’.

  9. cody says:

    Hi Cesar. I can’t simulate the behaviour you are saying… Which browser and version are you using?

  10. Jai says:

    Awesome… really useful script…

  11. [...] Resource: Sample | Tutorial [...]

  12. Amit says:

    Thanks;But is there any way so that the color of the counter
    change with the number of character left, just like twitter…

  13. [...] Pour cela, j’ai légèrement adapté l’excellent travail réalisé sur le plugin jquery JMaxInput et ajouter un évènement onsubmit qui compte la longueur de la chaîne de [...]

  14. [...] jMaxInput: jQuery ile Twitter benzeri Textarea jMaxInput, verece?iniz input limiti ile size twitter benzeri bir textarea olu?turmaktad?r. bu jquery eklentisinin di?er güzel bir özelli?i ise verdi?iniz limit textarea’n?n üzerinde yazd?kça azalan bir ?ekilde görünmesidir. [...]

Leave a Reply