• jQuery 选择器


    1.

                  基本选择器

                         $("h1").css("color", "blue"); //标签选择器

                         $(".price").css({"background":"#efefef","padding":"5px"}); //类选择器

                         $("#author").css("clor", " #083499"); //id选择器

                         $(".intro,dt,dd").css("color", " #ff0000");//并集选择器

                         $("*").css("font-weight", "bold"); //全局选择器

                  层次选择器

                         $(".textRight p").css("color","red"); //后代选择器

                         $(".textRight>p").css("color", "red"); //子选择器

                         $("h1+p").css("text-decoration", "underline"); //相邻元素选择器

                         $("h1~p").css("text-decoration", "underline"); //同辈元素选择器

                  属性选择器

                         $("#news a[class]").css("background","#c9cbcb");//a标签带有class属性

                        $("#news a[class='hot']").css("background", "#c9cbcb"); // class为hot

                        $("#news a[class!='hot']").css("background", "#c9cbcb");// class不为hot

                        $("#news a[href^='www']").css("background","#c9cbcb");//以www开头

                        $("#news a[href$='html']").css("background", "#c9cbcb");//以html结尾

                        $("#news a[href*='k2']").css("background","#c9cbcb"); //包含"k2"的元素

           2.

                  基本过滤选择器

                         :eq(index)     选取索引等于index的元素(index从0开始)

                         :gt(index)        选取索引大于index的元素(index从0开始)

                         :lt(index)     选取索引小于index的元素(index从0开始)

                         :header   选取所有标题元素

                         :focus      选取当前获取焦点的元素

                         :animated    选取当前获取焦点的元素

           3.

                  可见性过滤选择器

                         :visible      选取所有可见的元素

                         :hidden    选取所有隐藏的元素

  • 相关阅读:
    第二章 Centos7下Confluence7.4.0安装
    第一章 APM基本介绍
    第二十一章 MySQL导入数据常见报错解决
    第二十章 Centos7 下 Mysql 8.0.24编译安装
    第一章 Confluence基础介绍
    第十九章 Centos7下 Mysql 8.0.24 二进制安装
    团队项目冲刺阶段一(5)
    团队项目冲刺阶段一(4)
    团队项目冲刺阶段一(3)
    团队项目冲刺阶段一(2)
  • 原文地址:https://www.cnblogs.com/zhx2654188344/p/13200117.html
Copyright © 2020-2023  润新知