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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:19:24+00:00 2026-05-11T16:19:24+00:00

I have 2 radios: <input id=a_15_0 type=radio value=abc name=a_15/> <input id=a_15_1 type=radio value=xyz name=a_15/>

  • 0

I have 2 radios:

<input id="a_15_0" type="radio" value="abc" name="a_15"/>
<input id="a_15_1" type="radio" value="xyz" name="a_15"/>

Both are unselected. I have only the name of the radio, i.e a_15, but not the IDs.

1) How can I get the value of the selected option of this radio? E.g if the user clicked ‘xyz’, how can I get it? Right now I’m using:

var val=$('[name="a_15"]').val();

Which always gives abc even when xyz is selected.

2) How can I get xyz to be selected through javascript, without knowing the ID of the radio which says xyz? Doing:

$(‘[name=”a_15″]’).val(‘xyz’);

Changes the value of both radios to xyz rather than selecting the one whose value had been xyz.

Do I need to use document.myForm.a_15.value? Would that work consistently?

  • 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-11T16:19:24+00:00Added an answer on May 11, 2026 at 4:19 pm

    Have you tried using the val() in conjunction with the :checked selector?

    $('[name="a_15"]:checked').val();
    

    As for setting the selection based on the value, you may have to perform a multiple attribute tests?

    $('[name="a_15"][value="xyz"]').get(0).checked = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have a group of radio with an onchange handler: <input type=radio name=Q12 value=radio
So, I have 3 radio buttons: <input type=radio name=status value=enabled class=radio <?php if($news_row['status']==1) echo
I have the following code: <fieldset id=dificuldade> <legend>Dificuldade:</legend> <input type=radio name=dificuldade value=facil> Fácil </input>
I have below radio button on my web, <input id='element_1_1' name='element_1' class='element radio' type='radio'
I have the following snipped of my page: <div class=radio-group> <input type=radio name=group1 checked=checked
I'm calling a function from an input radio button and have this: onClick=\changeBilling('.$results['id'].', this.value)\
I have a table <table> <tr><td><input radio name=R1 onClick=getOtherColumnData()>first</td><td>TR1-TD2</td><td>TR1-TD3</td><td>TR1-TD4</td></tr> <tr><td><input radio name=R1 onClick=getOtherColumnData()>Second</td><td>TR2-TD2</td><td>TR2-TD3</td><td>TR2-TD4</td></tr> <tr><td><input
I have a list of input type radio buttons in formview (edit mode) and
I'm building a form with radio buttons. <form id=land name=input method=POST action=test.php> <input type=radio

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.