limit on textarea [solved]
Posted: Wed Jan 25, 2006 9:59 pm
I tried searching for this, but I found nothing that was actually relevant... I wasn't even sure what to search for... so here it goes...
the html tag <textarea> doesn't have a 'maxlength' feature that restricts the number of characters the user can input like the <input> tag does... (unless I am missing something)
So I am sure I need javascript to do this.
so far I have this...
(I want to only allow upto 150 characters in the textarea)
currently... this does nothing. I am sure I need to select anything over 150 and delete it.. or select everything upto the 150 character and set that as the textarea's value or something like that... but I dont know how to do this
Or is there a way to just not allow any more characters?
I don't want to disable it or anything like that because I still want them to be able to edit it or delete or whatever they need to do... just not allow more than 150 characters in the area.
Thanks in advance for your help.
the html tag <textarea> doesn't have a 'maxlength' feature that restricts the number of characters the user can input like the <input> tag does... (unless I am missing something)
So I am sure I need javascript to do this.
so far I have this...
(I want to only allow upto 150 characters in the textarea)
Code: Select all
function bioMax() {
var textareaLen = '';
if (document.forms['addMember'].elements['add_bio'].value.length > 150) {
textareaLen = document.forms['addMember'].elements['add_bio'].value;
}
}Or is there a way to just not allow any more characters?
I don't want to disable it or anything like that because I still want them to be able to edit it or delete or whatever they need to do... just not allow more than 150 characters in the area.
Thanks in advance for your help.