Mutation Observer for creating new elements
问题 I am trying to make a function go off when a particular div is created. In the simplest of terms, I have something like this: <a href=\"\" id=\"foo\">Click me!</a> <script> $(\"#foo\").live(\"click\",function(e) { e.preventDefault(); $(this).append($(\"<div />\").html(\"new div\").attr(\"id\",\"bar\")); }); </script> Before, I had mutation events listen for the creation of div#bar - something like this: $(\"#bar\").live(\"DOMNodeInserted\", function(event) { console.log(\"a new div has been