You can simply use the jQuery :checked selector in combination with the val() method to find the value of the selected radio button inside a group. While working with radio buttons, seldom we have to retrieve the selected radio button value with a click or change javascript events. Answer: Use the jQuery :checked selector. How to get the value of selected radio button in a group using jQuery. For illustration purposes, when the RadioButton is clicked based on whether it is checked (selected) or unchecked (unselected), a JavaScript function will be called within which the HTML DIV with TextBox will be shown or hidden. Use checked selector with val() to Get Selected Radio Button Value. Once we know how to update the radio button using JavaScript or jQuery, we can update the selection based on some event like a button click or any by some other element selection. @Piterden First of all, this answer is 6 years old! Wondering how to use the jQuery onclick event? The input can be accessed and its property can be set by using the attr method. Do you wish to execute some custom code on click of a button, a hyperlink, etc.? Output: Radio button 2 is selected. Click each button for the currently selected value of the radio button. As long as I used radio buttons it worked fine. $("input:radio[name=options]").attr("disabled",true); DEMO: Enable or Disable Radio buttons → Enable or disable single Radio buttons $("#opt1").attr("disabled",true); In this article, I am going to share easy examples that show how to trigger an action when an element on a web page is clicked. Arrow functions has been introduced in ES6 for situations when you either don't care about the this value or you want to use the surrounding context this value in your handler, this snippet uses this.And claiming using regular functions is "old bad practice" is utterly meaningless! DEMO: Select radio button using Button Click → Enable or disable all Radio buttons By click event of a button we can enable or disable the group of radio buttons. 2. TAGs: JavaScript, RadioButton To test it, let us update our form to add a button. You don’t know if this is the initial click or a second click on an already checked radio button. I create radio buttons dynamically and using a on() function try to capture the click and do something with it. I then encapsulated the radio buttons within a bootstrap markup to turn it into a button group - now when I click the button the click event never fires. Still, it might become a headache for some beginners to get the selected value of a radio button. Topic: JavaScript / jQuery Prev|Next. jQuery: $('input[type="radio"]').on('click change', function(e) { console.log(e.type); }); both the click and change events are fired when selecting a radio button option (at least in some browsers). Any HTML element can receive this event… You can also get the value of the selected radio button using the selector :checked with the function val(). If yes, then this article is for you. How to use the jQuery onClick event The problem with using a click handler is that by the time it is called, the radio button is already checked. I should also point out that in my example the click event is still fired when you use tab … However, some of you won’t consider a hectic task. Clicking on the ‘Get Free’ button: Clicking on the ‘Get Premium’ button: Clicking on the ‘Reset options’ button: Method 2: Using attr method: It is similar to the above method and more suitable for older jQuery versions. The click event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed and released. This method is a shortcut for .on( "click", handler ) in the first two variations, and .trigger( "click" ) in the third. I'm sure this should be easy, but I can't figure out the exact selector I need: I've got 2 radio buttons, and only want an onclick event from the second Click event on a specific radio button - jQuery Forum Check the Radio Button Based on a Button Click. No idea what I'm missing! Get Value of Selected Radio Button […] Here Mudassar Ahmed Khan has explained with an example, how to implement OnClick event of HTML RadioButton using JavaScript. So I’m using two event handlers, mousedown to set the previous state, then the click …