Results 1 to 2 of 2

Thread: Textbox Visibility Issue

  1. #1
    Join Date
    Apr 2007

    Question Textbox Visibility Issue

    Hello Gang!

    I have a bit of a troublesome spot. I am working on a web page for an instructional course. The user reads a scenario, and then in a text field types their response. What I want to have is a button which says "Check" below the text field which will THEN show a textfield which already has a paragraph of the appropriate answer in it. I have code I found on another reference site, but it does the reverse... the text box is visible right away and you click on a text link to make the box be hidden. Can someone please help modify my code so the textarea is hidden initially and shows when the user clicks the check button?
    <script type="text/javascript">
    function hide(status) {
    if (status == "hidden") {
        document.getElementById("textbox").style.visibility = "hidden";
        document.getElementById("button").innerHTML = "<a onclick=\"hide(\'show\')\" href=\"#\">Show Textbox<\/a>";
    else {
        document.getElementById("textbox").style.visibility = "visible";
        document.getElementById("button").innerHTML = "<a onclick=\"hide(\'hidden\')\" href=\"#\">Hide Textbox<\/a>";
    HTML Code:
    <span id="button">
      <a onclick="hide('hidden')" href="#">Hide Textbox</a>
    <textarea cols="32" rows="8" id="textbox" name="Answer" >Use the internal reporting chain of command. You should immediately bring this to the attention fo your supervisor. If the situation does not seem to be addressed, you should report it to the next higher level supervisor, contact your CBI Officer, or call the CBI helpLIne.</textarea>
    Any help is greatly appreciated!


  2. #2
    Join Date
    Jan 2009
    For starters, you should load the answer field, as a hidden field when the document loads:

    function hideAnswer(){

    Then its a process of logic from there.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center