我是靠谱客的博主 坚强小懒虫,这篇文章主要介绍jQuery中的HelloWorld,现在分享给大家,希望可以做个参考。

首先要先下载jQuery的库
这里用的是 jquery-1.12.4.min.js

代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
//$(function(){})相当于window.onload,代码写在{}之间
$(function() {
//1.选取button:$("button")
//2.为button 添加onclike 相应函数 $("button").click(function(){})
//代码写在function的{}里
$("button").click(function(){
//3.弹出helloworld

alert("helloworld");
});
})
</script>
</head>
<body>
<button>ClickMe</button>
</body>
</html>

运行结果`

这里写图片描述

最后

以上就是坚强小懒虫最近收集整理的关于jQuery中的HelloWorld的全部内容,更多相关jQuery中内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部