title: Access dynamically created items using jQuery?
body: <p>I have a page where some html is being dynamically added to the page.</p>
  
  <p>This is the html and javascript that is created:</p>
  
  <pre><code>&lt;div&gt;
      &lt;script type="text/javascript" language="javascript"&gt;
          $('#btn').click(function() {
              alert("Hello");
          });
      &lt;/script&gt;
  
      &lt;a id="btn"&gt;Button&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Looking in my Firebug console, I get an error that says:</p>
  
  <blockquote>
    <p>TypeError: $("#btn") is null</p>
  </blockquote>
  
  <p>jQuery is being loaded on the page initially.</p>
  
  <p>What am I doing wrong here?</p>