Wednesday, February 20, 2013

jQuery : Disable and apply styles on Chebox changed

Needed to enable or disabled based on the checkbox checked or unchecked status. All are ASP.NET server side controls.


    $(function () {
         $("#<%=chkConfirm.ClientID%>").on('change', function(e) { 
                 if ($(this).is(':checked')) { 
   $("#<%=btnContinue.ClientID%>").addClass('enabledButton').removeClass('disabledButton');
                     $("#<%=btnContinue.ClientID%>").prop('disabled', false);} 
          else { 
   $("#<%=btnContinue.ClientID%>").addClass('disabledButton').removeClass('enabledButton');
                     $("#<%=btnContinue.ClientID%>").prop('disabled', true);}
         });
    });


No comments:

Post a Comment