Skip to content

Custom jQuery selector, through which we can choose the specified CSS style characteristics of the DOM elements.

Notifications You must be signed in to change notification settings

wendux/style-selector-jQuery-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
wen.du
Dec 10, 2016
698793c · Dec 10, 2016

History

3 Commits
Dec 10, 2016
Dec 10, 2016
Dec 10, 2016
Dec 10, 2016
Dec 10, 2016

Repository files navigation

style-selector-jQuery-plugin

Customer jQuery selector, through which we can choose the specified CSS style characteristics of the DOM elements.

中文文档:http://www.jianshu.com/p/88c101483a9d

How to use

Suppose there is a document like this:

<body>
<div id="c" style="font-size:14px">
    <div style="color:#f00; background-color:white;">1</div>
    <div style="color:gray;  font-weight:bold">2</div>
    <div style="color:green;background-color:white;">3</div>
    <div style="color:red;background-color:white;">4
        <div style="font-size: 14px">14px</div>
        <div style="font-size: 15px">15px</div>
    </div>
    <div style="color:blue;font-size:18px;">5</div>
</div>
</body>
  1. Select all elements with red color :

    $("#c :css({color:'red'})")
  2. Select all elements the fontSize of which is greater than or equal to 16px:

     $("#c :css({fontSize:'>=16px'})")

    you can also use operators "=="、">"、"<"、">="、"<="、"!=".

  3. Select all elements with white color and backgroundColor yellow:

    $("#c :css({backgroundColor:'white',color:'yellow'})");
  4. Select all elements with fontSize 14px under the elements with red color:

    $("#c :css({color:'red'}) :css({fontSize:'14px'})")

All css attributes are supported by ":css" selector.

About

Custom jQuery selector, through which we can choose the specified CSS style characteristics of the DOM elements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published