SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to count number of chars while writing in textarea ?

    Hi

    i need to count the number of chars while the user is typing in the textarea or input, coz there are limit abd i wanna show him how many char he haa typed, and how many he can type !


    is there any way to do this with Js. ?





    thx alot !

  2. #2
    SitePoint Enthusiast Analyser's Avatar
    Join Date
    Oct 2002
    Location
    Delft, The Netherlands
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a snippet of example code:

    Code:
    <form name="myform">
    <input type="text" name="mytext" size="20" maxlength="15"
    onkeyup="this.form.charsleft.value = (this.maxLength - this.value.length)">
    <br>
    You can type <input type="text" name="charsleft" value="15" size="3"> more chars
    </form>
    "A poor programmer is he who blames his tools."
    http://analyser.oli.tudelft.nl/

  3. #3
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx ..

    but how to get how many char is wroted while is writing ?

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kosz haver

    a szemem elott volt es nem lattam this.value.length

  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SzÝvesen


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •