moth needs js help
- Started
- Last post
- 6 Responses
- moth
http://www.determinedmoth.org/!s…
This script checks a textarea for max input and spits out a warning. How do I put in if/else statements to to check which textarea is being used?
I'm a bit of a JS noob, and php is only getting me so far...
ta.
- UndoUndo0
use the onChange() event handler to call the function as the user types, as only one text area can be changed at once you wont need to repeat the function
- flavorful0
Also, you may want to put a lookup that after they wish to submit that it checks the length again - barring them from contiuning if they are over the max length.
As in the past working with this, people can still copy/paste over the limit.
- moth0
Anyone else find it odd that maxlength doesn't apply to these?
- UndoUndo0
I dont think textarea's support it Moth, seems odd but i'm sure there will be some quirky reason why it was decided not to add it. did yr js work out?
- moth0
Hmm. no...
Nevermind. I think I'll just let it eat peoples words. Much better fun.
- UndoUndo0
did you do it like this:
[textarea id="mytextArea"
onchange="upperCase(this.id)"]also check out