Blogger Information
Blog 24
fans 0
comment 1
visits 14923
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0402课后作业
张成钢的博客
Original
478 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jQuery引入方式与ready</title>
	<style type="text/css">
		div {
			width: 300px;
			height: 200px;
			background-color: skyblue;
			margin-bottom: 20px;
		}

	</style>


	<!-- jQuery的引入方式 -->
	<!-- 1.在线引用 -->
	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<!-- 2.本地引用 -->
	<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>


	<script type="text/javascript">
		// jquery的ready()方法
		// 1.给document绑定ready事件
		$(document).ready(function(){
			console.log('绑定事件')
			$("#div1").css("background","red")

		})

		// 2.给jQuery的全局函数 传入 回调函数
		$(function(){
			console.log('简写回调函数')
			$("#div1").css("background","blue")			
		})	

	</script>
</head>

<body>
	<div id="div1"></div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post