1. :not() Selector


        not selector

        Description: Selects all elements that do not match the given selector.

        • version added: 1.0jQuery( ":not(selector)" )

          selector: A selector with which to filter by.

        All selectors are accepted inside :not(), for example: :not(div a) and :not(div,a).

        Additional Notes

        The .not() method will end up providing you with more readable selections than pushing complex selectors or variables into a :not() selector filter. In most cases, it is a better choice.

        Example:

        Finds all inputs that are not checked and highlights the next sibling span. Notice there is no change when clicking the checkboxes since no click events have been linked.

        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19
        20
        21
        22
        23
        24
        25
        26
        27
        28
        29
        <!doctype html>
        <html lang="en">
        <head>
        <meta charset="utf-8">
        <title>not demo</title>
        <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
        </head>
        <body>
        <div>
        <input type="checkbox" name="a">
        <span>Mary</span>
        </div>
        <div>
        <input type="checkbox" name="b">
        <span>lcm</span>
        </div>
        <div>
        <input type="checkbox" name="c" checked="checked">
        <span>Peter</span>
        </div>
        <script>
        $( "input:not(:checked) + span" ).css( "background-color", "yellow" );
        $( "input").attr( "disabled", "disabled" );
        </script>
        </body>
        </html>

        Demo:

          1. http://www.ilxs21.cn | http://m.ilxs21.cn | http://wap.ilxs21.cn | http://3g.ilxs21.cn | http://4g.ilxs21.cn | http://5g.ilxs21.cn | http://mobile.ilxs21.cn | http://vip.ilxs21.cn | http://ios.ilxs21.cn | http://anzhuo.ilxs21.cn | http://f.ilxs21.cn | http://f29c.ilxs21.cn | http://21.ilxs21.cn | http://www.ilxs21.cn/2ac.html | http://www.ilxs21.cn/c952.html | http://www.ilxs21.cn/021fb8.html | 学长把我抱到厕所里啊