title: How to detect new element creation in jQuery?
body: <p>Lets say I have the following code that returns number of anchor elements on a page:</p>
  <pre><code>function getLinkCount() {
      alert(&quot;Links:&quot; + $(&quot;a&quot;).length);
  }
  </code></pre>
  <p>If I call in on document ready it would work as expected. But what if now a new link gets inserted into a page dynamically through Javascript, how can I get notified to run link counter function again? (I have no control over a script that could create a new link).</p>
  <p>Basically I am looking for something similar to <code>live()</code> only that would be watching element creation event, something like:</p>
  <pre><code>$(&quot;a&quot;).live(&quot;create&quot;, getLinkCount);
  </code></pre>
  <p>that would trigger when a new element is created.</p>