1. Selector
1. Select all the paragraphs in the document according to the tag name: $ (' P ')
2. By ID: $ ("#some-id")
3. Class: $ ('. Some-class ') $ ('. tab curr '). Removeclass ("Curr");.
$ (' tr:odd '). addclass (' odd '); Filter the odd elements in the selection result set
$ (' Tr:even '). addclass (' even '); Filter even elements in the selection result set
2, this
Onclick= "Changestate (); $ (this). addclass (' Curr ')"
3. Hide and Show
$ (' #some-id '). Show (); No effect, will automatically record the original display property values (such as: block, inline), and then reply to the display value
$ (' #some-id '). Hide (); No effect, equivalent to: $ (' #some-id '). CSS (' Display ', ' none '); Hiding elements, not preserving physical locations
The display or concealment of a gradual change in size and transparency
$ (' #some-id '). Show (' slow '); Specifies the display speed at which the height, width, and opacity of the element are gradually increased to the attribute value, with the following: Slow is 0.6 seconds, normal is 0.4 seconds, fast is 0.2 seconds, or the number of milliseconds is filled in directly
$ (' #some-id '). Hide (800); As with the. Show () specifies the speed display, the height, width, and opacity of the specified time are gradually reduced to 0
Fade in and fade
$ (' Some-id '). FadeIn (' slow '); The Opacity property value is increased from 0 to 1 in the specified time
$ (' Some-id '). FadeOut (' slow '); The opacity value is reduced from 1 to 0 within the specified time
4, var textval = $ ("#text_id"). Val ();
5. Remove elements from matching elements, like empty elements
$ (' #some-id '). empty ();
6. Remove the matched element and its descendant elements from the DOM
$ (' #some-id '). Remove ();
JQuery Common Code