<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            #app {
                width: 100px;
                height: 100px;
                background-color: #eee;
            }
            #app p{
                height: 20px;
                background: #000000;
            }
        </style>
    </head>

    <body>
        <div id="app">
            <p></p>
        </div>
        
    </body>

</html>

 

 

1.   on()方法

$("#app").on("click mouseover", function() {
      console.log(1)
});

2.bind()方法

$("#app").bind("click mouseover", function() {
     console.log(1)
});

3.delegate()方法

$("#app").delegate("p", "click mouseover", function() {
    console.log(1)
});

 

相关文章:

  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案