Radio button checked event handling
问题 In my application, I need a radio group, in which whenever a radio-button is checked, an alert occur so that I can post it's value to ajax post with jQuery. Can you help me please how i can do it in jQuery? 回答1: Try something like this: $(function(){ $('input[type="radio"]').click(function(){ if ($(this).is(':checked')) { alert($(this).val()); } }); }); If you give your radio buttons a class then you can replace the code $('input[type="radio"]') with $('.someclass') . 回答2: Update in 2017: Hey