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

  • Home
  • SEARCH
  • 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 7822321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:53:54+00:00 2026-06-02T07:53:54+00:00

What I want is: if(document.forms[0].elements[0][1].checked) OR if(document.forms[0].elements[0].[1].checked) What works is: if(document.forms[0].rad[1].checked) Given: <h3>Who’s Bill?</h3>

  • 0

What I want is:

if(document.forms[0].elements[0][1].checked)

OR

 if(document.forms[0].elements[0].[1].checked)

What works is:

if(document.forms[0].rad[1].checked)

Given:

<h3>Who's Bill?</h3>
<input type="radio" value="0" name="rad">Bill Clinton
<input type="radio" value="1" name="rad">Bill Gates
  • 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-06-02T07:53:55+00:00Added an answer on June 2, 2026 at 7:53 am

    Well, your second preferred option is simply syntactically wrong. It won’t work in any situation, as it defies the rules of the language.

    Your first preferred approach is not unreasonable, but consider that what you’re asking for is a specific element. Namely, the first element in the form. That element is a SINGLE radio button, not a group of them, so, as much as that syntax might be your preference, it doesn’t actually follow what you’re looking at in the code.

    The way it works is that the form gets an array object named after the radio group name, and that array’s children are populated in the order in which your radio buttons actually turn up.

    You can also access them as
    document.forms[0].elements["rad"][0];// (1, 2… etc)
    Which may feel nicer to you? I don’t know… I’m not sure what you’re basing your preferred approach on, so, it’s hard to say if this would appeal to you more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What if I have 2 forms on 1 page: <form id=form1> <input type=text />
I don't want to use an <input type=submit /> button to submit a form
function focus(element) { document.form.element.focus(); } I want to have a function to focus on
I have the following problem: Within a stylesheet document I want to create an
I want to delete a document in lucene 2.4 with java. My code is
I want to download a document from a server. Creating the document in the
I want to use Python to access MFC document files generically? Can CArchive be
I want to print a Word document, mydocument.docx, from a button in an Excel
I want to parse the following XML document to resolve all entities in it:
I want to parse an html document after it has loaded and discover all

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.