如何在網頁中初始化 jQuery?
在 web 中初始化 jQuery 非常簡單。你可以嘗試執行以下程式碼瞭解如何在網頁中初始化 jQuery。我們使用 Google CDN 來新增 jQuery。微軟 CDN 也可用於將 jQuery 庫新增到 HTML 中。
範例
<html> <head> <title>jQuery Function</title> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function() { $("div").click(function() {alert("Welcome to Tutorialspoint!");}); }); </script> </head> <body> <div id = "mydiv"> Click on this to see a dialogue box. </div> </body> </html>
廣告