title: jQuery force dynamic event to bind first
body: <p>I'm binding events on the document element to make them dynamic.</p>
  
  <p>The problem is that these events execute AFTER events binded directly on the elements. </p>
  
  <p>I have code that binds an element to execute first, but it doesn't work with dynamic content. Here is the code I would use for non dynamic content :</p>
  
  <pre><code>bindFirst: function (name, fn) {
          var elem, handlers, i, _len;
          this.bind(name, fn);
          for (i = 0, _len = this.length; i &lt; _len; i++) {
              elem = this[i];
              handlers = jQuery._data(elem).events[name.split('.')[0]];
              handlers.unshift(handlers.pop());
          }
      }
  </code></pre>
  
  <p>This function is under .fn.extend. </p>
  
  <p>As I said earlier, I want to be able to do the same, for for dynamic content bound on the document variable. Eg... </p>
  
  <pre><code>$(document).on("click", "div", function(){});
  </code></pre>
  
  <p>I want this to execute AFTER the code directly above :</p>
  
  <pre><code>$("div").on("click", function(){});
  </code></pre>