<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="aDiv" style="width: 100px;height: 100px;background-color: yellow;"></div>
<button id="aBtn">点击变色</button>
<script>
$('#aBtn').click(function () {
$("#aDiv").css("background-color","red");
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="bDiv" style="width: 100px;height: 100px;background-color: red;">
<p>p标签</p>
</div>
<button id="bBtn">点击改变内容</button>
<script>
$('#bBtn').click(function () {
$("#bDiv p").text("我是子元素");
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="cDiv" style="width: 100px;height: 100px;">
<p>p标签</p>
<p style="background-color: red;">p标签</p>
<p>p标签</p>
</div>
<button id="cBtn">点击改变第二个p标签背景</button>
<script>
$('#cBtn').click(function () {
$("#cDiv p:eq(1)").css("background-color","orange");
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<ul>
<li>AAA</li>
<li>BBB</li>
<li>CCC</li>
</ul>
<script>
$('#deleteBtn').click(function () {
$('ul li:last').remove();
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<button id="deleteBtn">点我删除最下面的li</button>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<script>
$('p').on('click',function () {
alert($(this).index());
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="Box" style="height: 100px;width: 100px;background-color: red;position: absolute;"></div>
<button id="Btn" style="margin-top: 100px;">向右移动按钮</button>
<script src="jQuery/jquery-3.4.1.min.js"></script>
<script>
$('#Btn').click(function () {
$('#Box').animate({
"left":"500px",
});
});
</script>
</body>
</html>