一、jquery为多个选择器绑定同一个事件

$("#start,#end").on("click",function(){
    alert("The paragraph was clicked."); });

二、多个事件绑定同一个函数

$("p").on("mouseover mouseout",function(){

    $("p").toggleClass("intro");

})

三、多个事件绑定不同函数

$("p").on({

    mouseover:function(){$("body").css("background-color","lightgray");},

    mouseout:function(){$("body").css("background-color","lightblue");},

    click:function(){$("body").css("background-color","yellow");}

  });
04-30 01:37