<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="./js/jquery.min.js"></script> <style> div { width: 100px; height: 100px; background-color: pink; } </style> </head> <body> <div></div> <p>11</p> <script> $("div").on({ click: function() { console.log("我点击了"); }, mouseover: function() { console.log("我鼠标经过了"); } }) //自动触发 $("div").click(); //第二种方式 $("div").trigger("click"); //第三种情况 //不会触发默认行为 $("div").triggerHandler("click"); </script> </body> </html>