jQuery: The Write Less, Do More JavaScript Library

TextArea CountDown

View: New views
3 Messages — Rating Filter:   Alert me  

TextArea CountDown

by shapper :: Rate this Message:

| View Threaded | Show Only this Message


Hello,

Does anyone knows a good JQuery countdown that displays the number of
remaining characters on a text box?

Thank You,
Miguel

Re: TextArea CountDown

by mkmanning :: Rate this Message:

| View Threaded | Show Only this Message


No, but it's pretty easy to write one :)

<textarea></textarea>
<div id="counter"></div>

$('textarea').keyup(function(){
      if(this.value.length >= 100) {
           //handle the over the limit part here
           $(this).addClass('overlimit');
           this.value = this.value.substring(0, 100);
      } else {
          $(this).removeClass('overlimit');
      }
     $('#counter').text(100-this.value.length);
});

On Mar 15, 7:37 am, shapper <mdmo...@...> wrote:
> Hello,
>
> Does anyone knows a good JQuery countdown that displays the number of
> remaining characters on a text box?
>
> Thank You,
> Miguel

Re: TextArea CountDown

by shapper :: Rate this Message:

| View Threaded | Show Only this Message


Thank You!

On Mar 15, 5:09 pm, mkmanning <michaell...@...> wrote:

> No, but it's pretty easy to write one :)
>
> <textarea></textarea>
> <div id="counter"></div>
>
> $('textarea').keyup(function(){
>       if(this.value.length >= 100) {
>            //handle the over the limit part here
>            $(this).addClass('overlimit');
>            this.value = this.value.substring(0, 100);
>       } else {
>           $(this).removeClass('overlimit');
>       }
>      $('#counter').text(100-this.value.length);
>
> });
>
> On Mar 15, 7:37 am, shapper <mdmo...@...> wrote:
>
> > Hello,
>
> > Does anyone knows a good JQuery countdown that displays the number of
> > remaining characters on a text box?
>
> > Thank You,
> > Miguel