参考文档: https://jquery.cuishifeng.cn/
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><script src="lib/jquery-3.6.0.js"></script>
</head>
<body>
<ul id="test-ul"><li class="js">JavaScript</li><li name="python">Python</li>
</ul>
</body>
</html>
节点文本操作
// 获取和修改元素的值: 原来的写法
// document.getElementById('test-ul')// $('#test-ul li[name=python]').text() // text()没有值代表获取值
// $('#test-ul li[name=python]').text('test') // text('test')有值代表重新赋值// $('#test-ul li[name=python]').html()
// $('#test-ul li[name=python]').html('<strong>123</strong>')
css 的操作
// css 的操作
$('#test-ul li[name=python]').css({ "color": "#ff0011", "background": "blue" })
元素的显示和隐藏
// 元素的显示和隐藏: 本质: display: none
$('#test-ul li[name=python]').show() // 显示
$('#test-ul li[name=python]').hide() // 隐藏
更多方法可以参考: https://jquery.cuishifeng.cn/
https://www.bilibili.com/video/BV1JJ41177di?p=29