title: jQuery - hide / show divs when checkboxes are checked
body: <p>I have a jquery function to show or hide divs when certain checkboxes are checked or unchecked and work fine using the "change" function. Therefore, if the checkbox has already been previously checked the corresponding div is not shown. How can I change this code to work?</p>
  
  <p>My code is here: </p>
  
  <pre><code>&lt;script&gt;
      jQuery(document).ready(function($) {
  
          $('.my_features').change(function() {
              var checkbox = $(this);                 
              if( checkbox.is(':checked') ) {                       
                  $( '#' + checkbox.attr('data-name') ).show();
              } else {                      
                  $( '#' + checkbox.attr('data-name') ).hide();
              }
          });
      });
  &lt;/script&gt;
  </code></pre>