title: Custom JavaScript in WordPress Contact Form 7 not working
body: <p>I'm trying to hide the contact form after it passes validation and is submitted. I want to do this with a simple custom JavaScript function.</p>
  
  <p>The thing is, the console keeps informing me that my JS function is undefined. At first I had thought that this might be happening because I'm not enqueing the *.js correctly, but that's not the case - my custom.js is clearly visible in the page's source code, and its contents match what I'd put inside.</p>
  
  <p>Here's my code so far.</p>
  
  <p>functions.php (child theme)</p>
  
  <pre><code>add_action( 'wp_enqueue_scripts', 'for_contact' );
  function for_contact() {
      wp_enqueue_script(
          'contactFormHide',
          get_stylesheet_directory_uri() . '/custom.js',
          array('jquery')
      );
  }
  </code></pre>
  
  <p>custom.js</p>
  
  <pre><code>var $j = jQuery.noConflict();
  
  $j(document).ready(function() {
      "use strict";
  
      function contactFormHide (){
          $('.section_inner_margin').css('display','none');
          $('.section_inner').html('&lt;div class="wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok" style="display: block;" role="alert"&gt;Your message has been sent.&lt;/div&gt;');
      }
  
  });
  </code></pre>
  
  <p>Contact Form 7 settings (Additional Settings tab)</p>
  
  <pre><code>on_sent_ok: "contactFormHide()"
  </code></pre>
  
  <p>What am I doing wrong, and how can I correct it?</p>