title: javascript or jQuery doesn't work in dynamically generated content
body: <p>Morning people. How to make my javascript or jquery works in dynamically generated content.<br/><br/>
  Basically, i have created web page that generates contents, base on what user clicks on the navigation menu. <br/><br/>
  The problems i am facing:</p>
  
  <ol>
  <li>when main page generate contents from content-page, jquery or javascript won't work.</li>
  <li>but when i open up the content-page alone, everything works.</li>
  </ol>
  
  <p>Information collected through searching:</p>
  
  <blockquote>
    <p>jQuery.load() method ignores the script tag that comes together with the that content generated dynamically.</p>
  </blockquote>
  
  <p>So i try the following:</p>
  
  <ol>
  <li>Put the  tag that i need in main page, not in content-page. it doesn't work. seem like the jquery can't find the content element, because they are dynamically generated.</li>
  <li>Since jQuery.load() ignores script tag, I tried pure javascript ajax like how w3schools.com teaches, the xmlhttp way, to generate the content. It doesn't work.</li>
  <li>When a button is clicked. no response in console.</li>
  </ol>
  
  <hr>
  
  <p><strong>Example</strong> contact.php</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function() {
      $("#submitUser").click(function(e) {
      var fname = $("#fname").val();
      $("#theresult").text(fname);
      e.preventDefault();
  });
  });
  &lt;form id="contactForm"&gt; 
  &lt;label for='fname' &gt;First Name&lt;/label&gt;&lt;br/&gt;
  &lt;input id="fname" type="text" name="fname" maxlength="100" /&gt;
  &lt;/form&gt;
  &lt;div id="theresult"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>When this contact.php is dynamically generated into other page, it doesn't work. When I click "submit" button, console shows no response. seem like the jquery is not exists.<br/>
  But when I open it alone in browser, it works.</p>