I have been searching all weekend for the solution to this quandry and have yet to find a solution that works correctly. What I am trying to acchieve is to limit the number of charatcers per line in a textarea - not limiting them identically, but a different number of characters per line of my choosing.
For Example:
- I want to have only 4 lines in my textarea
- Line 1,2 and 3 will be limited to 24 characters
- Line 4 will have an unlimited number of characters
Is this possible with a textarea, or is there another way of doing i with a Div or something. I do realise that this has in all likelihood been covered before, but to find an actual working script that covers this criterium has proved extremely difficult and I don't have the kind of skill it takes to acchieve these results.
Thanks
Below is a sample snapshot of the problem that you're trying to solve:
Snapshot of the textarea:
JavaScript:
This can be accomplished using a keypress event. When the keypress event fires, get the current value of the textbox and split the value into an array using the
\n
line break character as a delimiter.This is not designed to be a complete solution, but this will definitely get you started and provide you with something that you can modify to suit your needs. Good luck!