title: Bootstrap Uncaught TypeError: $(...).modal is not a function
body: <p>I'm trying to automatically close the modal after submitting the data to Mailchimp. But that's where the above issue occurs. I tried several existing solutions here, but they didn't seem to fix the issue. I have firing bootstrap events but still no use. I have pasted below the modal with the mailchimp api code (I've hidden some parts for privacy concerns) with the external bootstrap and jquery links. Please help.</p>
  
  <pre><code>//functions.php 
      function front_page_popup() { ?&gt;
        &lt;!-- Modal --&gt;
        &lt;div id="newsletter" class="modal fade bd-example-modal-lg rounded-0 mt-3 pr-0" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"&gt;
          &lt;div class="modal-dialog modal-lg" role="document"&gt;
            &lt;div class="modal-content"&gt;
              &lt;div class="container pt-5 px-5 pb-0"&gt;
                &lt;div class="d-flex justify-content-center mt-0"&gt;
                  &lt;i class="fas fa-lightbulb fa-3x"&gt;&lt;/i&gt;
                &lt;/div&gt;
                &lt;div class="d-flex justify-content-center my-2"&gt;
                  &lt;h1 class="text-center"&gt;&lt;strong&gt;Subscribe for Weekly Goodies&lt;/strong&gt;&lt;/h1&gt;
                &lt;/div&gt;
                &lt;div class="d-flex justify-content-center my-2"&gt;
                  &lt;p class="text-secondary text-center"&gt;Proven Strategies To Earn Online Straight To Your Inbox.&lt;/p&gt;
                &lt;/div&gt;
                &lt;div class="d-flex justify-content-center my-4"&gt;
                  &lt;hr style="width: 75%; border-width: 2px;"&gt;
                &lt;/div&gt;
                &lt;div class="d-flex justify-content-center my-4"&gt;
                  &lt;img class="w-25 h-50 rounded-circle" src="https://d1aettbyeyfilo.cloudfront.net/yoursolutions/6999175_1576332391276Thomas_Edison.jpg" alt="thomas edison"&gt;
                  &lt;div class="d-flex flex-column bd-highlight my-auto ml-3"&gt;
                    &lt;div class="p-2 bd-highlight"&gt;
                      &lt;q&gt;&lt;em class="text-secondary"&gt;Genius is one percent inspiration and ninety-nine percent perspiration.&lt;/em&gt;&lt;/q&gt;
                    &lt;/div&gt;
                    &lt;div class="p-2 bd-highlight"&gt;
                      &lt;p&gt;&lt;strong&gt;Thomas Edison&lt;/strong&gt;&lt;/p&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="mc_embed_signup" class="container-fluid bg-light"&gt;
                &lt;form action="{hid--for--privacy--reasons}" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" target="_blank" class="needs-validation" novalidate&gt;
                  &lt;div class="form-row"&gt;
                    &lt;div class="col"&gt;
                      &lt;input type="text" name="FNAME" class="form-control form-control-lg mt-5 mb-2 mx-auto" style="width: 80%;" id="mce-FNAME" placeholder="First Name..." required&gt;
                      &lt;div class="invalid-feedback text-center"&gt;
                        Please provide your name.
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-row"&gt;
                    &lt;div class="col mb-3"&gt;
                      &lt;input type="email" name="EMAIL" class="form-control form-control-lg mt-3 mb-2 mx-auto" style="width: 80%;" id="mce-EMAIL" placeholder="Email Address..." required&gt;
                      &lt;div class="invalid-feedback text-center"&gt;
                        Please provide your email address.
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div id="mce-responses" class="clear"&gt;
                    &lt;div class="text-center" id="mce-error-response" style="display:none; color: red;"&gt;&lt;/div&gt;
                    &lt;div class="text-center" id="mce-success-response" style="display:none; color: green;"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;button id="mc-embedded-subscribe" class="btn btn-primary btn-lg btn-block mt-2 mb-5 mx-auto" style="width: 80%; background-color: #9661f3; border-color: #9661f3;" type="submit"&gt;
                    &lt;strong&gt;Subscribe Now&lt;/strong&gt;
                  &lt;/button&gt;
                &lt;/form&gt;
              &lt;script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'&gt;
              &lt;/script&gt;
              &lt;script type='text/javascript'&gt;
              (function($) {
                window.fnames = new Array();
                window.ftypes = new Array();
                fnames[0]='EMAIL';
                ftypes[0]='email';
                fnames[1]='FNAME';
                ftypes[1]='text';
                $('#newsletter').modal('hide');
              }
              (jQuery));
                var $mcj = jQuery.noConflict(true);
                &lt;/script&gt;
              &lt;!--End mc_embed_signup--&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
      &lt;?php }
      add_filter('wp_footer', 'front_page_popup');
  </code></pre>
  
  <p>below is the external links</p>
  
  <pre><code>//External links in functions.php
  wp_deregister_script('jquery');
  wp_enqueue_script('jquery', 'https://code.jquery.com/jquery-3.4.1.slim.min.js', array(), null, true);
  wp_enqueue_script('bootstrap-js', get_stylesheet_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '4.4.1', true);
  </code></pre>