js模擬自動點擊事件
阿新 • • 發佈:2019-04-17
tle set title query col rip get UNC charset
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>
js模擬自動點擊事件