事件委派笔记1
<!DOCTYPE html><html> <head> <title>left.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="C:\Users\Administrator\Desktop\jquery-1.9.0.js"></script><style type="text/css">*{margin:0;padding:0;}</style><script type="text/javascript">$(function(){ console.log($("#div1")); $("p").click(function(){alert("clicked");});$("#div1").on("click","p",function(){alert("on clicked");});$("div").append("<p>hello</p>");});</script> </head> <body> <div id="div1"></div> </body></html>