SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard rbutler's Avatar
    Join Date
    Jul 2003
    Location
    Springfield, MO
    Posts
    1,867
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Radio button toggle

    Does any one have a reference site that shows how to show/hide a textfield after a radio button has been selected? I have two radio buttons, and when a visitor selects yes, it shows, no it hides. This part of the script for me works except for the fact that its inaccessible when JS is disabled.

    Code:
    function offcitizen(){
    document.getElementById("hidethiscitizen").style.display = 'none';
    }
    function oncitizen() {
       document.getElementById("hidethiscitizen").style.display = '';
    }
    Followed by this on the table row:

    Code:
    <tr id="hidethiscitizen">
    And the appropriate onclick behavior for the radio button. Anyone know of a solution to make this accessible when JS is disabled?
    Ryan Butler

    Midwest Web Design

  2. #2
    SitePoint Addict darkwater23's Avatar
    Join Date
    Nov 2005
    Location
    Omaha, NE
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I usually do is show all the rows, write a Javascript function to hide what needs to be hidden and execute that function onLoad.

  3. #3
    SitePoint Wizard rbutler's Avatar
    Join Date
    Jul 2003
    Location
    Springfield, MO
    Posts
    1,867
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well that's the idea, but since I'm not JS intensive, where might I find such a script? I have one for check boxes, but, it won't work for radio buttons.
    Ryan Butler

    Midwest Web Design


Bookmarks

Posting Permissions

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