title: How to trigger the DOMNodeInserted event after injecting HTML with jQuery
body: <p>In one of our projects we load slides into our webpage with use of AJAX. After the slides are loaded I want jQuery to execute a plugin on all new injected elements automatically.</p>
  
  <p>This is the code I found else where but it didn't do the trick. Also I've tried to replace <code>.on</code> function with the <code>.bind</code> function but then the whole site died and JavaScript crashes with an overflow.</p>
  
  <pre><code>function loaded(selector, callback) {
      //trigger after page load.
      jQuery(function () {
          callback(jQuery(selector));
      });
      //trigger after page update eg ajax event or jquery insert.
      jQuery("body").on('DOMNodeInserted', selector, function (e) {
          callback(jQuery(this));
      });
  }
  </code></pre>
  
  <p>I got the problem reproduced in a <a href="https://jsfiddle.net/ssd34vkg/">JSFiddle</a>.</p>