如何儲存和再現 jQuery 事件?
要儲存和再現 jQuery 事件,請使用console 進行記錄。
示例
你可以嘗試執行以下程式碼來了解如何儲存和再現 jQuery 事件
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ window.events = [] $("#track").click(function(event){ window.events.push(event) $.each(window.events, function(i, item){ console.log(i, item); }); }); }); </script> </head> <body> <a href="#" id="track">Track</a> </body> </html>
廣告