zoukankan      html  css  js  c++  java
  • JS

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>this的使用</title>
        <script src="jquery-3.4.1.min.js"></script>
        <style>
            .test{
                background: skyblue;
                color: snow;
            }
        </style>
    </head>
    <body>
        <button>aaa</button>
        <button>bbb</button>
        <button>ccc</button>

        <script>
            $(()=>{
                 $("button").click(function(){
                    $(this).addClass("test")//为当前元素增加test类
                    $(this).siblings().removeClass("test")//获取元素的兄弟元素,并去掉他们的test类
                });
            })
        </script>
    </body>
    </html>
  • 相关阅读:
    android listview simpleAdaper
    android appwigt
    android shortcut &livefoulder
    android 命令行
    React Native for Android 学习笔记
    android dialog
    android Menu
    Android Gallery
    Android Listview
    Android
  • 原文地址:https://www.cnblogs.com/500m/p/12532241.html
Copyright © 2011-2022 走看看