<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<! --
1. Simple filter selector: matches elements according to certain filtering rules and starts with a colon (:) in writing. Simple filter selector is the most widely used filter selector.
JQuery selector details
Based on the elements in the obtained page, jQuery selectors can be divided into four categories: Basic selector, level selector, filter selector, and form selector. There are six filter selectors: simple filter selector, content filter selector, visibility filter selector, attribute filter selector, child element filter selector, and form object attribute filter selector.
-->
<Title> Use jQuery basic filter selector </title>
<! -- Use the jQuery basic filter selector to select an element: on the page, set a <Script src = "jquery-1.9.1.js" type = "text/javascript"> </script>
<Style type = "text/css">
Body {font-size: 12px; text-align: center ;}
Div {width: 240px; height: 83px; border: solid 1px # eee}
He {font-size: 13px ;}
Ul {list-style-type: none; padding: 0px}
. DefClass ,. notClass {height: 23px; width: 60px; line-height: 23px; float: left; border-top: solid 1px # eee; border-bottom: solid 1px # eee}
. GetFocus {width: 58px; border: solid 1px #666; background-color: # eee}
# SpnMove {width: 234px; height: 23px; line-height: 23px ;}
</Style>
<Script type = "text/javascript">
$ (Function () {// Add the category of the first element
$ ('Li: first '). addClass ('getfocal ');
})
$ (Function () {// Add the category of the last element
$ ('Li: la'). addClass ('getfocal ');
})
$ (Function () {// Add to remove all element classes that match the given Selector
$ ('Li: not (. NotClass) '). addClass ('getfocal ');
})
$ (Function () {// Add all element classes whose index values are even and count from 0
$ ('Li: even'). addClass ('getfocal ');
})
$ (Function () {// Add all element classes with an odd index value, counted from 0
$ ('Li: odd'). addClass ('getfocal ');
})
$ (Function () {// Add an element category for the given index value, counting from 0
$ ('Li: eq (1) '). addClass ('getkey ');
})
$ (Function () {// Add all element categories greater than the given index value, counted from 0
$ ('Li: gt (1) '). addClass ('getkey ');
})
$ (Function () {// Add all element categories smaller than the given index value, counted from 0
$ ('Li: lt (4) '). addClass ('getkey ');
})
$ (Function () {// Add the title class Element category
$ ('Div h1'0000.css ('width', '2013 ');
$ (': Header'). addClass ('getfocal ');
})
$ (Function (){
AnimateIt (); // adds the animation effect element category
$ ('# SpnMove: animated'). addClass ('getfocal ');
})
Function animateIt () {// animation effect
$ ('# SpnMove'). slideToggle ('low', animateIt );
}
</Script>
</Head>
<Body>
<Div>
<H1> basic filter selector <Ul>
<Li class = "DefClass"> Item 0 </li>
<Li class = "DefClass"> Item 1 </li>
<Li class = "NotClass"> Item 2 </li>
<Li class = "DefClass"> Item 3 </li>
</Ul>
<Span id = "spnMove"> Span Move </span>
</Div>
</Body>
</Html>