<!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() 函数 

jQuery.parseHTML() 函数

相关文章:

  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-11
  • 2021-06-07
猜你喜欢
  • 2022-12-23
  • 2021-08-18
  • 2021-11-05
  • 2021-11-26
  • 2021-12-20
  • 2022-12-23
  • 2021-04-05
相关资源
相似解决方案