Monday, June 27, 2011

how to find out a radio button is clicked

if you have id of radio button and the value that you have fixed it very simple to get things done.

jQuery(document).ready(function(){
jQuery("#rd1").change(function(){
    if (jQuery("input[name='rdbtn']:checked").val() == '1')
        {
        jQuery('#acctype').hide();
       
        jQuery('#acctypenav').show('slow');
}else{
    jQuery('#acctype').show();
       
        jQuery('#acctypenav').hide('slow');
   
    }
   
   
});




 jQuery("#rd2").change(function(){
    if (jQuery("input[name='rdbtn']:checked").val() == '2')
        {
        jQuery('#acctype').hide();
       
        jQuery('#acctypenav').hide('slow');
}else{
    jQuery('#acctype').hide();
       
        jQuery('#acctypenav').hide();
   
    }
   
   
});

No comments:

Post a Comment