Jump to content

Scroll bar in text area.


Recommended Posts

Don't you want scrollbars? Like the colls="" and the rows="" as a maximum of characters?Then add maxlength="" for the maximum of chars, while cols and rows only define the initial width and height of the textarea :)

Actuall textarea does not support maxlength.You can do it with javascript like this thoJS
function maxLength(object,maxLength){  return (object.value.length <= maxLength);}


<textarea id="myTA" onkeypress="return maxLength(this,15)"></textarea>

Replace 15 witht he max length you want.

Link to comment
Share on other sites

hmm aspnetguy,okey but its not working perfectly. if i put max length of 1000 chars in javascript and width of text box as 50 chars now i put a word with 51 chars then it will show the horizontal scroll.any guess ?

Like Dan said, If you set the cols=50, then it should not show any horizontal scrollbar... did u try this...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...