Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    glz
    glz is offline
    New Coder
    Join Date
    Apr 2007
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Tell if textarea has scrollbars or not, or has 'overflowed'?

    Let's say you have a textarea 30px by 30px, you fill it with more than 10,000 text characters. It will obvious that the scrollbars will activated because there is so much text in the small space. In other words, it 'overflowed'. Now other than common sense, is it possible to tactically tell with javascript/css when text in a textarea has overflowed, or caused there to be the appearance of of scrollbars, height scrollbars and/or width scrollbars.

    If so, I'd like to see some code to achieve this.

    -Thanks

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    725
    Thanks
    35
    Thanked 132 Times in 123 Posts
    var who= some_textarea //(or any element);
    var hasScroll= who.scrollHeight > who.offsetHeight;

  • Users who have thanked mrhoo for this post:

    glz (06-21-2008)

  • #3
    glz
    glz is offline
    New Coder
    Join Date
    Apr 2007
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    hoo anks
    I"ll try it out.


  •  

    Posting Permissions

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