阅读背景:

jQuery中replaceWith()与replaceAll()方法_nairuozi的博客

来源:互联网 

replaceWith()与replaceAll()两个方法作用相同。

见代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery-3.3.1.js"></script>
	</head>
	<body>
		<span>Hello</span>
		<b>Hello</b> 
		<i>Hello</i>
		
        <script>
			$("span,b,i").replaceWith("<h3>Word</h3>")

            //等同于$("<h3>Word</h3>").replaceAll("span,b,i");

		</script>
	</body>
</html>
<!D



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: