<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.select{
color: blue;
background-color: #F1F1F1;
font-weight: bold;
}
</style>
<script src="../js/jquery-3.5.1.js"></script>
<script>
$(function () {
//样式操作,添加class
//$().addClass("类名");
$("#btn1").click(function () {
$("li:nth-child(odd)").addClass("select");
});
});
</script>
</head>
<body>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>Javascript</li>
<li>jQuery</li>
<li>Vue.js</li>
</ul>
<input type="button" id="btn1" value="添加">
</body>
</html>