aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to enable a textarea in javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to enable a textarea in javascript? " Watch "how to enable a textarea in javascript? " New topic
Author

how to enable a textarea in javascript?

jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
hi! i have a textarea that is currently disabled. using javascript how can enable it on button click?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onclick="document.formname.elementName.disabled=false;"

Eric
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"j son",
Please check you private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
hi, i tried the code but it doesnt seem to work, there is an "error on page" showing in the status bar below the browser and nothing happens with the textarea

textarea and button inside form1

thanks in advance
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
i hope you understand the code, i removed all "<" and "/>" and renamed onclick to nclick because i am having trouble in posting the code
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"j son"

Ben asked you to check your private messages.
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
Originally posted by David O'Meara:
"j son"

Ben asked you to check your private messages.


yes, i just updated my profile
please help me with my code
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
When you click on that icon in the status bar it brings up a dialog window. What is the error message?



In the future replace the o in onsubmit and onclick with &#111;

Eric
[ August 14, 2007: Message edited by: Eric Pascarello ]
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
Originally posted by Eric Pascarello:
When you click on that icon in the status bar it brings up a dialog window. What is the error message?



In the future replace the o in onsubmit and onclick with &#111;

Eric


i tried the code.. there is no error on the page but the textarea is still disabled

<html>
<body
><form id="form1" method="post" action="">
<textarea name="textarea" cols ="60" rows="10" disabled="disabled" id="textarea"> IT Project-1 students please check LMS for prelim requirement.</textarea>
<input name="edit" type="button" id="label2" onclick="document.getElementById("textarea").disabled = false; return false;" value="Edit">
</form>
</body>
</html>
[ August 14, 2007: Message edited by: jason pogi ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
here is code that works:




Eric
[ August 14, 2007: Message edited by: Eric Pascarello ]
jason pogi
Greenhorn

Joined: Aug 13, 2007
Posts: 9
it worked.. my error is in document.getElementById("ta1").disabled the paramater should be in single quote 'ta1' .
thanks for helping!
 
 
subject: how to enable a textarea in javascript?