I got two textareas. I push a form button and some text fills both textareas, lets say “x” for area one and “y” for area two. I then disable the first textarea with a another button so that when I push the fill button again, only textarea two gets updated. To do that I use this:
document.myform.mytextarea.disabled=true;
It works on Firefox, Opera, IE8, but not on IE7. With IE7 both textareas change content, in does not matter that I disabled the first one. I get the same problem if I use:
The javascript code disables the textarea in the meaning that the user cannot manually delete och add stuff to the textarea. But if I push the desribed fill button both areas gets updated - which I wanted to avoid.
So my question is: how do I lock the content in the textarea? None of these methods works.
disabling a textarea prevents the user entering content ,
prevents the field from being included when its form is submitted,
and takes it out of the tab-to next field collection by blocking focus to it.
It does not prevent you from writing to its value with a script-
just check it’s disabled property before you change the value.