Blogger Information
Blog 38
fans 0
comment 0
visits 29619
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0420jquery两种引入方式和载入方式
riskcn的博客
Original
715 people have browsed it

1、jQuery可以本地文件引入和在线库引入;

2、jQuery语句放到页面前方的话须使用$(document).ready()方法提前加载DOM部分

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>0402jquery的二种引入方式</title>
	<!-- jquery的二种引入方式 -->
	<!-- <script type="text/javascript" src="js/jquery.3.3.1.js"></script> -->
	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<script type="text/javascript">
		$(document).ready(
			function(){
				$('ul>li:nth-child(2)~*').css('background-color','lightblue')
			})
	</script>
</head>
<style type="text/css">
	.box{width:500px;margin:0 auto;border:1px solid #eee;}
	ul{overflow: hidden;list-style: none;margin:0;padding: 0}
	.box ul li{float:left;width:40px;height:40px;text-align: center;line-height: 40px;background: lightgreen;border-radius: 50%;margin:20px;}
</style>
<body>
	<div class="box">
		<ul>
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
		</ul>
	</div>
</body>
</html>

运行实例 »

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


Correction status:qualified

Teacher's comments:
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