www.webdeveloper.com
Results 1 to 2 of 2

Thread: Manipulating text field versus a button

  1. #1
    Join Date
    Feb 2006
    Posts
    21

    Manipulating text field versus a button

    Is the hiding/showing of text fields done differently than for buttons? I ask because I have the following text field:

    Code:
    <input type="text" name="case_id_c" class="sqsEnabled" tabindex="0" id="case_id_c" size="" value="" >
    And if I call the following javascript, this field disappears:

    Code:
    document.getElementById('case_id_c').style.display = 'none';

    However, I have the following button:

    Code:
    <input type="button" name="btn_clr_case_id_c" tabindex="0" title="Clear [Alt+C]" accessKey="C" class="button" onclick="this.form.case_id_c.value = ''; value="Clear">

    And if I run the following code, nothing happens:

    Code:
    document.getElementsByName("btn_clr_case_id_c").style.display = 'none';

    Not sure what's going on. Any thoughts???

  2. #2
    Join Date
    Feb 2006
    Posts
    21
    Nevermind. I got it. I changed:

    Code:
    document.getElementsByName("btn_clr_case_id_c").style.display = 'none';

    To this:

    Code:
    var x = document.getElementsByName("btn_clr_case_id_c");
    x[0].style.display = 'none';

Thread Information

Users Browsing this Thread

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

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



Recent Articles