Text Area + Scrolling Issues

Associate
Joined
4 May 2003
Posts
582
I have a text area on my webpage that is 18 chars in width at source. When I type into the textarea I can type more than 18chars and a scrollbar appears on the horizontal axis of the textarea.

How can I enforce a maximum of 18chars per line within my text area?

Thanks
 
MaxLength="18" ?


Captain-Fungi said:
I have a text area on my webpage that is 18 chars in width at source. When I type into the textarea I can type more than 18chars and a scrollbar appears on the horizontal axis of the textarea.

How can I enforce a maximum of 18chars per line within my text area?

Thanks
 
Sorry I should have explained myself better, it is a maximum of 18chars per row/line.

For instance I want it to look like this:

123456789123456789
123456789123456789

Instead I get:

123456789123456789123456789123456789123456789123456789

In Safari the textarea behaves as expected, in Firefox/IE it doesnt :rolleyes:
 
Last edited:
So you want to manually insert a linebreak after 18 characters have been typed?

Hook into the onkeypress event with Javascript, and use a regular expression to replace any 18 non-whitespace characters with said characters + \n.
 
Back
Top Bottom