Questions tagged [radio-button]

Radio buttons are elements used in forms. They let a user select exactly one of a limited number of choices.

radio-button
Filter by
Sorted by
Tagged with
385 votes
20 answers
1.1m views

How to get the selected radio button’s value? [duplicate]

I’m having some strange problem with my JS program. I had this working properly but for some reason it’s no longer working. I just want to find the value of the radio button (which one is selected) ...
mkyong's user avatar
  • 12.7k
3066 votes
39 answers
2.5m views

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?
juan's user avatar
  • 81.1k
335 votes
30 answers
1.4m views

How can I check whether a radio button is selected with JavaScript?

I have two radio buttons within an HTML form. A dialog box appears when one of the fields is null. How can I check whether a radio button is selected?
noob's user avatar
  • 4,749
470 votes
27 answers
1.7m views

How to get the value of a selected radio button

I want to get the selected value from a group of radio buttons. Here's my HTML: <div id="rates"> <input type="radio" id="r1" name="rate" value="...
ZombieBatman's user avatar
  • 4,703
476 votes
11 answers
170k views

How to bind RadioButtons to an enum?

I've got an enum like this: public enum MyLovelyEnum { FirstSelection, TheOtherSelection, YetAnotherOne }; I got a property in my DataContext: public MyLovelyEnum VeryLovelyEnum { get; ...
Sam's user avatar
  • 28.7k
1028 votes
33 answers
1.8m views

How to check a radio button with jQuery?

I try to check a radio button with jQuery. Here's my code: <form> <div id='type'> <input type='radio' id='radio_1' name='type' value='1' /> <input type='radio'...
Alexis's user avatar
  • 16.7k
798 votes
33 answers
1.8m views

jQuery get value of selected radio button

The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id. The problem is that I don't have control on how ...
user1114212's user avatar
  • 7,997
596 votes
4 answers
697k views

How to use the "required" attribute with a "radio" input field

I am just wondering how to use the new HTML5 input attribute "required" in the right way on radio buttons. Does every radio button field need the attribute like below or is it sufficient if only one ...
nerdess's user avatar
  • 10.5k
244 votes
27 answers
747k views

How do I change the color of radio buttons?

I mean, a radio button itself consists of a round shape and a dot at the center (when the button is selected). What I want to change is the color of both. Can this be done using CSS?
catandmouse's user avatar
  • 11.6k
548 votes
17 answers
914k views

How to uncheck a radio button?

I have group of radio buttons that I want to uncheck after an AJAX form is submitted using jQuery. I have the following function: function clearForm(){ $('#frm input[type="text"]').each(function(){ ...
systemsfault's user avatar
  • 15.3k
65 votes
16 answers
216k views

Can you style an html radio button to look like a checkbox?

I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by ...
Joel Coehoorn's user avatar
131 votes
9 answers
238k views

How to set OnClickListener on a RadioButton in Android?

I have two RadioButtons inside a RadioGroup. I want to set OnClickListener on those RadioButtons. Depending on which RadioButton is clicked, I want to change the text of an EditText. How can I achieve ...
mayur rahatekar's user avatar
103 votes
6 answers
117k views

Is it possible to change the radio button icon in an android radio button group

I am wanting to allow the user of my android application the ability to set some parameters. The radio button is ideal for this situation. However, I don't like the radio buttons are rendered. Is ...
yamspog's user avatar
  • 18.3k
54 votes
19 answers
216k views

How to get the selected radio button value using js [duplicate]

I am using this code to get the value of currently selected radio button, but it doesn't work. var mailcopy = document.getElementById('mailCopy').value; How to get the currently selected radio ...
Meena's user avatar
  • 967
132 votes
14 answers
360k views

Which Radio button in the group is checked?

Using WinForms; Is there a better way to find the checked RadioButton for a group? It seems to me that the code below should not be necessary. When you check a different RadioButton then it knows ...
Billy's user avatar
  • 2,600
333 votes
18 answers
569k views

In jQuery, how do I select an element by its name attribute?

I have 3 radio buttons in my web page, like below: <label for="theme-grey"> <input type="radio" id="theme-grey" name="theme" value="grey" />Grey</label> <label for="theme-...
djmzfKnm's user avatar
  • 27k
134 votes
17 answers
300k views

Angular2 - Radio Button Binding

I want to use radio button in a form using Angular 2 Options : <br/> 1 : <input name="options" ng-control="options" type="radio" value="1" [(ng-model)]="model.options" ><br/> 2 :...
Mourad Zouabi's user avatar
109 votes
21 answers
276k views

How to create radio buttons and checkbox in swift (iOS)?

I am developing an app that allows to do survey. My layout is generated from XML based questions. I need to create radio buttons (single choice) and checkboxes (multiple answers). I did not find ...
Vannian's user avatar
  • 1,520
181 votes
11 answers
231k views

Assign an initial value to radio button as checked

How do I assign the value of a radio button initially as checked in HTML?
RPB's user avatar
  • 16.2k
103 votes
21 answers
52k views

How to group RadioButton from different LinearLayouts?

I was wondering if is possible to group each single RadioButton in a unique RadioGroup maintaining the same structure. My structure look like this: LinearLayout_main LinearLayout_1 RadioButton1 ...
marcoqf73's user avatar
  • 1,324
267 votes
17 answers
359k views

Why can't radio buttons be "readonly"?

I would like to show a radio button, have its value submitted, but depending on the circumstances, have it not editable. Disabled doesn't work, because it doesn't submit the value (or does it?), and ...
mcv's user avatar
  • 4,287
144 votes
7 answers
521k views

Check a radio button with javascript

For some reason, I can't seem to figure this out. I have some radio buttons in my html which toggles categories: <input type="radio" name="main-categories" id="_1234" value="1234" /> // All &...
ptf's user avatar
  • 3,270
177 votes
9 answers
358k views

jQuery $("#radioButton").change(...) not firing during de-selection

About a month ago Mitt’s question went unanswered. Sadly, I’m running into the same situation now. http://api.jquery.com/change/#comment-133939395 Here’s the situation: I’m using jQuery to capture ...
antwarpes's user avatar
  • 2,277
70 votes
11 answers
76k views

MVVM: Binding radio buttons to a view model?

EDIT: Problem was fixed in .NET 4.0. I have been trying to bind a group of radio buttons to a view model using the IsChecked button. After reviewing other posts, it appears that the IsChecked ...
David Veeneman's user avatar
43 votes
4 answers
122k views

Tab Index on div

Please see the form HTML code below <form method="post" action="register"> <div class="email"> Email <input type="text" tabindex="1" id="email" value="" name="email"...
Mithun Sreedharan's user avatar
33 votes
5 answers
152k views

How to uncheck checked radio button [duplicate]

The thing is this solution work only in firefox $(':radio').on("change", function(event) { $(this).prop('checked', true); }); $(':radio').on("click", function(event) { $(this).prop('checked', ...
ccd580ac6753941c6f84fe2e19f229's user avatar
357 votes
9 answers
435k views

How do I group Windows Form radio buttons?

How can I group the radio buttons in Windows Form application (a lot like ASP.NET's radiobuttonlist!)? So I can switch between each case chosen from the options.
MW.'s user avatar
  • 3,589
45 votes
8 answers
68k views

How to use RadioGroup in ListView custom adapter?

I want to show a single select option in my list. I am using RadioButton in my listView row. I know that RadioGroup is used for single selection. But problem is that I have added the RadioButton in my ...
Arslan Anwar's user avatar
  • 18.7k
30 votes
13 answers
41k views

RadioGroup with two columns which have ten RadioButtons

I have a RadioGroup and I want to align buttons next to each other in two columns and five rows and I am unable to achieve it. Things I have tried: RelativeLayout -> Outside RadioGroup -> Inside ...
Jason Wood's user avatar
11 votes
3 answers
29k views

WinForms RadioButtonList doesn't exist?

I know that WebForms has a RadioButtonList control, but I can't find one for WinForms. What I need is to have 3 RadioButtons grouped together, so that only 1 can be selected at a time. I'm finding ...
Ryan Abbott's user avatar
  • 5,397
9 votes
1 answer
13k views

ANDROID - ExpandableListView

Im trying to figure out how to build a view that contains (many of): PARENT1 (checkable, expandable) CHILD1 (RADIO BUTTON) CHILD2 (RADIO BUTTON) ... PARENT2 (checkable, expandable) CHILD1 (...
no9's user avatar
  • 6,494
902 votes
5 answers
2.0m views

How to select a radio button by default? [duplicate]

I have some radio buttons and I want one of them to be set as selected by default when the page is loaded. How can I do that? <input type="radio" name="imgsel" value="" />
jslearner's user avatar
  • 21.8k
143 votes
15 answers
455k views

How to change the size of the radio button using CSS?

Is there a way to control the size of the radio button in CSS ?
Misha Moroshko's user avatar
103 votes
31 answers
352k views

How to make a radio button unchecked by clicking it?

Unlike check boxes, it is impossible for the user to deselect radio buttons once they are clicked. Is there any way so that they can be toggled programmatically using Javascript? This would be ...
Student's user avatar
  • 1,157
39 votes
9 answers
136k views

How to use jQuery to show/hide divs based on radio button selection?

I have some radio buttons and I'd like to have different hidden divs show up based on which radio button is selected. Here's what the HTML looks like: <form name="form1" id="my_form" method="post" ...
MT3's user avatar
  • 1,065
19 votes
11 answers
52k views

jQuery: make checkboxes act like radio buttons?

Is there a way to make checkboxes act like radio buttons? I assume this could be done with jQuery? <input type="checkbox" class="radio" value="1" name="fooby[1][]" /> <input type="checkbox" ...
superUntitled's user avatar
15 votes
2 answers
13k views

How to customize list preference radio button

I have customized all the radioButtons in my application but the radioButtons in the listPreference does not get customized. I have used this xml named btn_radio.xml <?xml version="1.0" encoding="...
Niraj Gupta's user avatar
5 votes
1 answer
4k views

How can I reduce RadioButton binding code?

I'm following this answer on how to databind enums (ints in my case) to RadioButtons, but if I've got several TabItems each with 10x10 grids of RadioButtons, is there any way to get rid of some of ...
Dax Fohl's user avatar
  • 10.8k
158 votes
5 answers
141k views

What is the difference between formControlName and FormControl?

I'm using ReactiveFormsModule of Angular2 to create a component that contains a form. Here is my code: foo.component.ts: constructor(fb: FormBuilder) { this.myForm = fb.group({ 'fullname'...
smartmouse's user avatar
110 votes
5 answers
119k views

Can you tab through all radio buttons?

I have a list of radio buttons. when I tab through them, seems like only the first radio button or the one that is selected will get focused, the rest of the radio buttons will get skipped. checkbox ...
qinking126's user avatar
  • 11.7k
50 votes
7 answers
117k views

Best radio-button implementation for IOS

I would like to ask if there are examples out there on how to implement radio-button options on an iPhone app. I find the Picker View quite big for a simple selection feature. I'm not sure if Apple ...
Jonas Arcangel's user avatar
46 votes
13 answers
140k views

Reading the selected value from asp:RadioButtonList using jQuery

I've got code similar to the following... <p><label>Do you have buffet facilities?</label> <asp:RadioButtonList ID="blnBuffetMealFacilities:chk" runat="server"> <asp:...
digiguru's user avatar
  • 12.8k
187 votes
10 answers
497k views

Jquery If radio button is checked

Possible Duplicate: Check of specific radio button is checked I have these 2 radio buttons at the moment so that the user can decide whether they need postage included in the price or not: <...
Daniel H's user avatar
  • 2,915
103 votes
19 answers
91k views

Add margin between a RadioButton and its label in Android?

Is it possible to add a little bit of space between a RadioButton and the label while still using Android's built-in components? By default the text looks a little scrunched. <RadioButton android:...
allclaws's user avatar
  • 5,655
75 votes
9 answers
167k views

How to make a radio button look like a toggle button

I want a group of radio buttons to look like a group of toggle buttons (but still function like radio buttons). It's not necessary that they look exactly like toggle buttons. How can I do this only ...
Pomber's user avatar
  • 1,165
48 votes
26 answers
257k views

jQuery check/uncheck radio button onclick

I have this code to check/uncheck a radio button onclick. I know it is not good for the UI, but I need this. $('#radioinstant').click(function() { var checked = $(this).attr('checked', true); ...
DiegoP.'s user avatar
  • 45.5k
42 votes
4 answers
98k views

How to add radio button dynamically as per the given number of counts?

I have tried this code..It will display three radio buttons in a single row when the emulator starts. But I need a button event for this. i.e; if I click the button, it should ask for number of radio ...
Dinesh Kumar's user avatar
  • 1,243
25 votes
2 answers
71k views

Android: Radio button in custom list view

I am developing an application in which I need to implement radio buttons in list view. I want to implement a list view having one radio button and two text views in each row. And one button "Ok&...
Manoj Fegde's user avatar
  • 4,721
21 votes
8 answers
261k views

show and hide divs based on radio button click [duplicate]

I want to be able to dynamically change what divs are show using radio button and jQuery - HTML: <div id="myRadioGroup"> 2 Cars<input type="radio" name="cars" checked="checked" value="...
Kiksy's user avatar
  • 1,282
18 votes
11 answers
93k views

How to get a checked radio button in a groupbox? [duplicate]

I have a lot of radio buttons in a groupbox. Normally I will check each radio button individually using If radiobutton1.Checked = True Then. But I think maybe there is smart way to check which radio ...
Predator's user avatar
  • 1,275

1
2 3 4 5
20