Get Radio Button value using jQuery

Here’s small piece of code to get the value of a checked or selected radio button out of a group of radio buttons.
var selValue = $('input[name=rbnNumber]:checked').val(); 
In above code, rbnNumber is name of the radio group.


HTML Code:

jQuery Code:


See Complete Code
You can also get the value of individual radio button using it's ID as selector.
var selValue = $('#rbnNumber:checked').val(); 
If you want to get ID of selected radio button out of group of radio button, then below code will work.
var selValue = $('input[name=rbnNumber]:checked').attr('id'); 
See Result, jQuery and HTML code below:

Feel free to contact me for any help related to jQuery, I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..