Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4332016
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:11:48+00:00 2026-05-21T10:11:48+00:00

I am trying to use JavaScript to update the checked status of a radio

  • 0

I am trying to use JavaScript to update the checked status of a radio button on a site managed by a large company. Here’s the issue – the page has duplicate IDs and names for the two related radio buttons and they reside in the cell of a row of an unnamed table. I want to select the first one. Thanks for any help.

Below is the basic html

<table cellspacing='0' cellpadding='0' border='0'>
    <tr>
        <td>
            <img alt='spacer' src='../Images/blank.gif' width='10' height='1' border='0' />
        </td>
        <td id='A-Q1_0200-1' valign='top'>
            <font size='-1'>
                <input type='radio' name='Q1_0200' id='Q1_0200' value='1' onclick='FormChanged()'
                class='bodyInput' />
            </font>
        </td>
        <td colspan='1' valign='top' id='A-Q1_0200-1-T'>
            <font size='-1'>
                &nbsp;Yes
            </font>
        </td>
        <td>
            <font size='-1'>
                &nbsp;
            </font>
        </td>
        <td id='A-Q1_0200-2' valign='top'>
            <font size='-1'>
                <input type='radio' name='Q1_0200' id='Q1_0200' value='2' checked='checked' onclick='FormChanged()'
                class='bodyInput' />
            </font>
        </td>
        <td colspan='1' valign='top' id='A-Q1_0200-2-T'>
            <font size='-1'>
                &nbsp;No
            </font>
        </td>
    </tr>
</table>

Below are the various javascript examples I’ve tried to update the radio to select the first radio option.

    document.getElementById('A-Q1_0200-1').Q1_0201.checked='checked'; 

    document.getElementById('A-Q1_0200-1').radio[0].checked=TRUE;

    document.getElementById('Q1_0200').checked=TRUE

    document.getElementById('Q1_0200').checked=’TRUE
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:11:49+00:00Added an answer on May 21, 2026 at 10:11 am

    You cannot have duplicate IDs and expect getElementById() to work. ID means “identity” and each ID needs to be unique. That is why your 3rd and 4th examples failed.

    The following code will select the parent <td> by it’s id, then it will select the first descendant input and set the checked property.

    document.getElementById('A-Q1_0200-1').getElementsByTagName("input")[0].checked = "checked";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to use AJAX to update a partial on a page. I following
I am trying to use JavaScript to start a marquee when a user puts
I am trying to use JavaScript to set an elements width relative to their
I am trying to use Pixastic JavaScript library for image manipulation in Windows 8
I am trying to use the flXHR javascript library for making cross-domain calls. I
I am trying to use an HTML form and javascript (i mention this, because
I'm trying to use the replace function in JavaScript and have a question. strNewDdlVolCannRegion
I'm trying to use Firebug to debug some Javascript that entails blur and focus
I am trying to use some rails code withing a javascript and need to
Original Post: I am trying to use the Client-side Authentication with the Javascript SDK

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.