evergreean
Technical User
I am trying to create a JS where the user can check a checkbox to make the textarea readonly or unclick the checkbox to make it not readonly (write).
Here is the JS:
Code:
if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.setAttribute('readonly','readonly');
}
else if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.setAttribute('readonly',true);
// also tried document.formOne.fieldtextarea.focus();
}
It does make the textarea readonly but once it is readonly I cant get it to switch back to write (Not readonly).
Please advise.