title: Jquery - run function when DOM element is added
body: <p>I have a website with jQuery and jQuery UI. I have a Javascript function:</p>
  
  <pre><code>function ToButton()
  {
  $(".ToButton").button();
  }
  </code></pre>
  
  <p>This function runing after the page load and change all elements with class "ToButton".</p>
  
  <p>Also I change HTML code when user press a button. E.g.:</p>
  
  <pre><code>$("body").append('&lt;span class="ToButton"&gt;Test Button&lt;/span&gt;');
  </code></pre>
  
  <p>And I want to run ToButton function to this new element too, but live or delegate methods in jQuery don't have "show" or "create" event type. So I need call function ToButton() after all HTML code changes.</p>
  
  <p>Can you help me, how I can delegate ToButton function to all elements?</p>