Blogger Information
Blog 87
fans 0
comment 0
visits 59369
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第十三节课作业:4.jQuery的基本语法
黄忠倚的博客
Original
491 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>4.jQuery的基本语法</title>
</head>
<body>
	<h2>基本语法:<span>$(选择器).方法()</span></h2>
	<p>基本流程:使用选择器找到DOM元素并打包成jQuery对象</p>
	<p>调用jQuery中的方法找到元素进行操作</p>
	<p>总结:找到元素,然后操作</p>
</body>
</html>
<script type="text/javascript" src="./js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
		$('h2 span').css('color','red')

		$('p+p+p').html('终于找到你了,开工吧')

		//$(selector):用来选择DOM元素并转为jquery对象
		// $():它还可以创建一个HTML元素

		// var img = $('<img src="./images/logo.png" width="150">')

		// img.insertAfter('h2')

		$('<img src="./images/mm.jpg" width="150">').insertAfter('h2').css('border-radius','50%')

		// var img = document.createElement('img')
		// img.src = '<img src="./images/mm.jpg" width="150>'
		// document.getElementsByTagName('h2')[0].appendChild(img)

</script>

运行实例 »

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


Correction status:Uncorrected

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