jQuery基础语法-文档就绪函数和基本语法使用20190729
刘静2019-07-29 11:37:38329<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery介绍与安装</title>
<script type="text/javascript" src="static/jQuery/jquery-3.4.1.js"></script>
</head>
<body>
<script type="text/javascript">
// 文档就绪函数
// 基本格式: 防止页面在完成之前加载代码
// $(document).ready(function(){
// })
// $(selector).action() 基本语法
$(document).ready(function(){
// $str="我是一个声明变量";
// alert($str);
$("div").hide();
$("button").click(function(){
$("div").show();
})
})
</script>
<div style="width:100px;height:100px;background:pink;">
</div>
<button>点击</button>
</body>
</html>