首页 > Web开发 > 详细

jQuery.parseHTML() 函数

时间:2016-10-23 17:13:23      阅读:149      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="app/js/jquery-2.1.4.js"></script>
		<script type="text/javascript">
			$(function() {
				var str = ‘<li>1</li><li>2</li><li>3</li><li>4</li><script type="text/javascript">console.log("执行脚本代码完成");<\/script>‘;
				var arr0 = jQuery.parseHTML(str, true);
				var arr1 = jQuery.parseHTML(str);
				console.log(arr0);
				console.log(arr0[0]);
				console.log(arr1);
				console.log(arr1[0]);
				$.each(arr0, function(i) {
					$("ul.sb").append(arr0[i]);   
				});
				$.each(arr1, function(i) {
					$("ul.sbs").append(arr1[i]);
				});
			})
		</script>
	</head>

	<body>
		<ul class="sb"></ul>
		<ul class="sbs"></ul>
	</body>

</html>

 技术分享 

技术分享

jQuery.parseHTML() 函数

原文:http://www.cnblogs.com/libin-1/p/5990022.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!