Blogger Information
Blog 250
fans 3
comment 0
visits 321680
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jQery--文档节点的操作
梁凯达的博客
Original
1088 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jquery 文本操作</title>
	<style>
		#dvs{
			width: 130px;
			height: 30px;
			border: solid 1px blue;
		}
	</style>

	<script src='jquery-3.3.1.min.js'></script>
</head>
<body>
	<!-- innerHTML  textContent -->
	<div id='dvs'><a href=""><button>天气热了,可以脱衣服了</button></a></div>
<script>
	$('#dvs').mouseover(function(){
		//设置文本
		$(this).html('<a herf="">这个是什么文本</a>');
		$(this).text('按钮')
		//获取文本
		var tx = $(this).html();
		console.log(tx);
	})
	$('#dvs').mouseout(function(){
		$(this).text('');
	})
</script>
</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