事件有三种形式:
onclick
onclick=function(){}
addEvent
除此之外jQuery还有变通形式:As of jQuery version 1.7, the on() method is the new replacement for the bind(), live() and delegate() methods. This method brings a lot of consistency to the API, and we recommend that you use this method, as it simplifies the jQuery code base.
$("p").click(function(){
alert("The paragraph was clicked.");
});
$("p").on("click", function(){
alert("The paragraph was clicked.");
});







网友评论