jquery基础事件的绑定用法

jquery基础事件的绑定用法

<div>www.dc3688.com</div>

1,bind用法

$("div").bind("click",function(){

  alert('');

})

2,简写的用法

$("div").click(function(){

alert("a");

})

3,多事件绑定用法

$("div").bind("mouseenter mouseleave", function() {

 $(this).toggleClass("entered");
});
$("div").bind({
 click: function() {
  // do something on click
 },
 mouseenter: function() {
  // do something on mouseenter
 }
});
posted @ 2020-03-31 09:02  学无边涯  阅读(103)  评论(0编辑  收藏  举报