Toggle Active Class on Checkboxes & Radio Buttons when Checked (Gravity Forms)

$(document).ready(function(){

	 // function after gravity forms has fully loaded
     $(document).bind('gform_post_render', function() {

          // add active class if checkbox is checked by default
          $('input[type="checkbox"]:checked').closest('li').addClass('active');

          // toggle active check class on checkbox inputs
          $('input[type="checkbox"]').change( function(){
               if ($(this).is(':checked') ) {
                    $(this).closest('li').addClass('active');
               } else {
                    $(this).closest('li').removeClass('active');
               }
          });

          // toggle active check class on radio inputs
          $('input[type="radio"]').change( function(){
               if ($(this).is(':checked') ) {
                    $(this).closest('li').addClass('active').siblings('li').removeClass('active');
               } else {
                    $(this).closest('li').removeClass('active');
               }
          });
     });
});