Alaa Abdelhaq Blog
13 Jul
let say you have a group of radio buttons sharing the same name attribute for sure, and upon submit or some event you want to check if one of these radio buttons was checked or not.
you can do this simply by the following code.
$(document).ready(function(){ $('#submit_button').click(function() { if (!$("input[@name='name']:checked").val()) { alert('Nothing is checked!'); return false; } else { alert('One of the radio buttons is checked!'); } }); });
hope this will help you
4 Responses for "Check if a radion button is checked using jquery"
hi keefak? it is helpful indeed!! do you know any useful resourses to learn jQuery other than online tutorials???
Thanks!!! Exactly what I needed.
It’s helpful !
Thanks !
woww this great information for me..thanksss
Leave a reply