jquery绑定多个事件及多个选择器

   //鼠标移出、移进、点击改类时触发事件

    $(".edit").on({
        mouseenter: function () {
            alert(1);
        },
        mouseleave: function () {
            alert(2);
        },
        click: function () {
            alert(3);
        }
    });
//.edit类中的后代元素.amend, span触发事件
  $(".article").on({
        mouseenter: function () {
            alert(1);
        },
        mouseleave: function () {
            alert(2);
        },
        click: function () {
            alert(3);
        }
    }, '.amend, span');

猜你喜欢

转载自blog.csdn.net/yh12346789/article/details/79782162