jQuery.fn.isChecked = function () { if ("prop" in jQuery(this)) { return jQuery(this).prop('checked') == true ? true : false; } if ("attr" in jQuery(this)) { return jQuery(this).attr('checked') == true ? true : false; } return jQuery(this).is(":checked") == true ? true : false; }; jQuery(document).ready(function () { $('#red_btn').click(function () { if ($('#coloropt1').isChecked()) { alert("Yes"); } else { alert("No"); } }); $('#green_btn').click(function () { if ($('#coloropt2').isChecked()) { alert("Yes"); } else { alert("No"); } }); $('#blue_btn').click(function () { if ($('#coloropt3').isChecked()) { alert("Yes"); } else { alert("No"); } }); });