1、直接上代码很直观

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
    <p>
        <button id="change" type="button">点击事件</button>
    </p>
    <script type="text/javascript">
        $(function() {
            setTimeout(function() {
                var buy = document.getElementById(\'change\'); 
                buy.click();
            }, 200); 
        });
        
        $("#change").click(function(){
            console.log("八戒你瘦了!")
        })
    </script>
    </body>
</html>

  

 

版权声明:本文为wuzaipei原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/wuzaipei/p/10721821.html