如何在网页中初始化jQuery?
在Web上轻松初始化jQuery非常容易。您可以尝试运行以下代码,以了解如何在网页中初始化jQuery。我们正在使用GoogleCDN添加jQuery。MicrosoftCDN也可用于将jQuery库添加到HTML的相同目的。
示例
<html>
<head>
<title>jQuery Function</title>
<script src = "https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("div").click(function() {alert("欢迎来到Nhooo!");});
});
</script>
</head>
<body>
<div id = "mydiv">
Click on this to see a dialogue box.
</div>
</body>
</html>