I have a textarea which is disabled by default. And then on press of 'Edit' I take some input from user. If it is valid, I want to enable the textarea. Here is the code which I have right now:
<textarea name="comment" cols="5" rows="2" disabled="true"><%= $tmp_com %></textarea>
<a href="javascript:validateUser()">Edit</a>
function validateUser(){
var name=prompt("Please enter the password");
    if (name=="1234")
    {
       document.getElementByName("comment").disabled="false";
    }
}
                There is no getElementByName in JavaScript. Easiest solution, add an id, and use getElementById.
<textarea name="comment" id="comment" cols="5" rows="2" disabled="true">
and JavaScript
document.getElementById("comment").disabled="false";
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With