• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to enable a textarea in javascript?

 
jason pogi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi! i have a textarea that is currently disabled. using javascript how can enable it on button click?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclick="document.formname.elementName.disabled=false;"

Eric
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"j son",
Please check you private messages.
 
jason pogi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"j son"

Ben asked you to check your private messages.
 
jason pogi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is code that works:




Eric
[ August 14, 2007: Message edited by: Eric Pascarello ]
 
jason pogi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it worked.. my error is in document.getElementById("ta1").disabled the paramater should be in single quote 'ta1' .
thanks for helping!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic