jquery同一标签绑定多个事件的几种方式

①$(document).ready(function(){ $("button").bind({ click:function(){$("p").slideToggle()}, mouseover:function(){$("body").css("background-color","red");}, mouseout:function(){$("body").css("background-color","#fffffff")}; }); }); ②$(function(){ $('#btn').bind("click",function(){ $("#test").append("<p>我的绑定函数1</p>"); }),bind("click",function(){ $("#test").append("<p>我的绑定函数2</p>"); }),bind("click",function(){ $("#test").append("<p>我的绑定函数3</p>") }); }); ③为元素一次性绑定多个事件类型 $(function(){ $("div").bind("mouseover mouseout",function(){ $(this).toggleClass("over"); }); });

posted @ 2017-07-10 09:17  小周同学  阅读(1889)  评论(0编辑  收藏  举报