<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.active {
color: red;
}
li {
cursor: pointer;
}
</style>
</head>
<body>
<div id="app">
<div>dfasdfadsf</div>
<div>dfasdfadsf</div>
<div>dfasdfadsf</div>
</div>
<ul>
</ul>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
// 获取app里面的html字符串
var str = $('#app').html();
console.log(str);
var str = $('#app').text();
console.log(str);
// 给ul添加内容
var str3 = `
<li>第1个li元素</li>
<li>第2个li元素</li>
<li>第3个li元素</li>
<li>第4个li元素</li>`;
$('ul').html(str3);
</script>
</body>
</html>