<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
div {
width: 100%;
height: 200px;
background-color: pink;
margin-top: 20px;
display: none;
}
</style>
</head>
<body>
<input type="button" id="btn1" value="显示"/>
<input type="button" id="btn2" value="显示内容"/>
<div></div>
<div></div>
<div></div>
<script src="jquery-1.12.4.js"></script>
<script>
$(document).ready(function () {
//注册事件,把on去掉,是一个方法
$("#btn1").click(function () {
//隐式遍历:偷偷的遍历,jQuery会自动的遍历,不需要我们遍历
$("div").show(1000);
});
$("#btn2").click(function () {
$("div").text("我是内容");
})
});
</script>
</body>
</html>