Unchecking Radio Buttons

Discussion in 'OT Technology' started by Clarity, Nov 19, 2009.

  1. Clarity

    Clarity New Member

    Joined:
    Feb 14, 2006
    Messages:
    3,309
    Likes Received:
    0
    Hello, I've been trying to figure out how to uncheck a radio box on an online form. Is there any method to do so? I have not been able to find any javascript to help me yet. Thanks in advance!
     
  2. sandor3kgt

    sandor3kgt New Member

    Joined:
    Nov 1, 2006
    Messages:
    646
    Likes Received:
    0
    Set its "checked" property to false.

    Javascript example:
    function uncheck()
    {
    document.getElementById("radio1").checked=false;
    }

    Check out this link for details:
    http://www.w3schools.com/jsref/dom_obj_radio.asp
     
  3. StevesVR4

    StevesVR4 Get Arrested

    Joined:
    Jul 1, 2003
    Messages:
    7,328
    Likes Received:
    0
    Ummm, that sort of goes against the purpose of a radio button. One of the buttons in the group should always be selected. If you want to check/uncheck an item, use a regular checkbox instead of a radio button.
     
  4. sandor3kgt

    sandor3kgt New Member

    Joined:
    Nov 1, 2006
    Messages:
    646
    Likes Received:
    0
    I'm guessing he may be trying to reset a form.
     
  5. Clarity

    Clarity New Member

    Joined:
    Feb 14, 2006
    Messages:
    3,309
    Likes Received:
    0
    Thanks for the help. I was trying to clear an answer to an online form that I had clicked mistakenly, from the user side. The site did not have a clear answer button.

    I simply posted "javascript:document.getElementById("nameofradiobutton").checked=false;;void(0);" into the address bar (after finding the radio button id), which cleared the button. Unfortunately, after moving to the next page of the form, and checking back, the button state hadn't changed. I believe it's simply the site's problem.

    Thanks anyways again! I might try creating another account or emailing support. Or just ignoring it, it's not too big of a deal, just annoying.
     

Share This Page