其他分享
首页 > 其他分享> > jQuery练习t197,从0到1

jQuery练习t197,从0到1

作者:互联网

<!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>

 

标签:jQuery,function,weight,color,t197,练习,select,addClass
来源: https://blog.csdn.net/modern358/article/details/113522125