//作用:获取元素
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!--导入jQuery-->
<script src="jquery-3.6.0.min.js"></script>
<style>
</style>
</head>
<body>
<ul>
<li class="a">12</li>
<li>34</li>
<li>4</li>
<li class="a">5</li>
<li>55</li>
<li id="box">999</li>
</ul>
<script>
//id选择器
var li1=$("#box")
console.log($("#box"))
//类选择器
var li2=$(".a")
console.log($(".a"))
//标签选择器
var li2=$("li")
console.log($("li"))
//结构选择器
//获取所有奇数个li
var li2=$("li:nth-child(odd)")
console.log($("li:nth-child(odd)"))
//获取所有第个偶数li
var li2=$("li:nth-child(even)")
console.log($("li:nth-child(even)"))
</script>
</body>
</html>