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
I am not a javascript person, but I found here for searching this problem. For who google it and find here, I am hoping that this helps some. So, as in question if we have a list of radio buttons:
I can find which one selected with this selector:
$('.list input[type="radio"]:checked:first').val();
Even if there is no element selected, I still don't get undefined error. So, you don't have to write extra if statement before taking element's value.
Here is very basic jsfiddle example.