title: Problem accessing a form within a script with Jquery and HTML
body: <p>I have problems accessing my form from the JS file, and I don't know how to access it. Here's my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#my-form").submit(function(e) {
    e.preventDefault();
    var textInput = $("#my-input").val();
    $("#container").html(textInput);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="container" class="container-fluid"&gt;&lt;/div&gt;
  &lt;script id="view-contact" type="text/html"&gt;
    &lt;form id="my-form" class="form"&gt;
      &lt;input id="my-input" type="text"&gt;
      &lt;input type="submit"&gt;
    &lt;/form&gt;
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>