1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Junque</title> |
---|
5 | <style type="text/css"> |
---|
6 | div { border: 2px blue solid; margin:3px; padding:3px; } |
---|
7 | </style> |
---|
8 | <script type="text/javascript" src="../jquery.js"></script> |
---|
9 | <script type="text/javascript"> |
---|
10 | function clearEm() { |
---|
11 | $("div").css("background", ""); |
---|
12 | } |
---|
13 | function useNotFunc() { |
---|
14 | clearEm(); |
---|
15 | $("div").not("div.asdf").css("background", "yellow"); |
---|
16 | } |
---|
17 | function useNotSelector() { |
---|
18 | clearEm(); |
---|
19 | $("div:not(div.asdf)").css("background", "yellow"); |
---|
20 | } |
---|
21 | function useAltNotMethod() { |
---|
22 | clearEm(); |
---|
23 | $("div").not($("div.asdf")).css("background", "yellow"); |
---|
24 | } |
---|
25 | function useSingleSelector() { |
---|
26 | clearEm(); |
---|
27 | $("div").not(".asdf").css("background", "yellow"); |
---|
28 | } |
---|
29 | |
---|
30 | $(document).ready(function () { |
---|
31 | $("button:eq(0)").click(useSingleSelector); |
---|
32 | $("button:eq(1)").click(useNotFunc); |
---|
33 | $("button:eq(2)").click(useNotSelector); |
---|
34 | $("button:eq(3)").click(useAltNotMethod); |
---|
35 | }); |
---|
36 | </script> |
---|
37 | </head> |
---|
38 | <body> |
---|
39 | <button>$("div").not(".asdf")</button> |
---|
40 | <button>$("div").not("div.asdf")</button> |
---|
41 | <button>$("div:not(div.asdf)")</button> |
---|
42 | <button>$("div").not($("div.asdf"))</button> |
---|
43 | <div><div></div> |
---|
44 | <div class="asdf"><div class = "asdf"></div> |
---|
45 | <div class="asdf"><div class = "asdf"></div> |
---|
46 | <div><div></div> |
---|
47 | </body> |
---|
48 | </html> |
---|