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 8041795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:20:36+00:00 2026-06-05T04:20:36+00:00

I have the following code: <form class=form-inline id=myform0> <fieldset> <label class=radio><input type=radio name=optionsRadios id=optionHere2

  • 0

I have the following code:

<form class="form-inline" id="myform0">    
    <fieldset>                  
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere2" value="2">Yes</label>
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere1" value="1">No</label>            
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere3" value="3">Not decided</label>                        
    </fieldset>                 
</form>
<form class="form-inline" id="myform1">    
    <fieldset>                  
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere2" value="2">Yes</label>
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere1" value="1">No</label>            
        <label class="radio"><input type="radio" name="optionsRadios" id="optionHere3" value="3">Not decided</label>                        
    </fieldset>                 
</form>

What I want to do is be able to programatically select a radio button in each group. Everything I tried so far has not worked. Thoughts?

Edit:

This selects all of them:
$(“input[name=optionsRadios][value=1]”).attr(‘checked’, ‘checked’);

I am just looking to select a specific one.

  • 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-05T04:20:38+00:00Added an answer on June 5, 2026 at 4:20 am

    To check each first radio button use the following code:

    $("form").each(function() {
        $(this).find(":radio:first").prop("checked", true);
    });
    

    Or shorter:

    $("form").find(":radio:first").prop("checked", true);​​​​​​​​​​​​​​​​
    

    Also check you have elements with the same IDs (e.g. optionHere1, optionHere2, etc).

    ID’s should be unique!

    DEMO: http://jsfiddle.net/mAeTa/


    UPDATE. This will also work fine:

    $("form").find(":radio[name='optionsRadios'][value='1']").prop("checked", true);​
    

    DEMO: http://jsfiddle.net/mAeTa/1/

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

Sidebar

Related Questions

I have the following code... <h3>Guests</h3> <form class=form-inline> <fieldset> <label class=control-label for=input01>First Name:</label> <input
I have the following code: index.jsp: <form name=f action=db/ajoutConducteur.jsp method=post> <input type=text pattern=\d{8} required
I have the following code: echo ' <td> <input type=button name=delete value=X onclick=clearSelection(this.form, '.$type.');this.form.submit();
<label class=checkbox inline> <input type=checkbox name=Services[] value=service1> Service 1 </label> <label class=checkbox inline> <input
I have the following form code: # forms.py class SomeForm(forms.Form): hello = forms.CharField(max_length=40) world
I have the following code (inherited from someone): <div class=feedback>&nbsp;</div> <form onsubmit=return false autocomplete=off>
I have the following code: public partial class Form1 : Form { public BindingList<Class>
I have the following Code: def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields =
I have the following code: public partial class Main : Form { private delegate
I have the following form code: class DisplaySharerForm(forms.Form): ORDER_BY_CHOICES = ( ('customer_sharer_identifier', 'customer_sharer_identifier'), ('action_count',

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.