Jquery
Chinese online document jquery.cuishifeng.cn
jquery Object [0] =dom Object
$ (DOM object) =jquery Object
Basic Selector
Find by ID
$ (' #i1 ')
Find by classname
$ ('. C1 ')
Find by label
$ (a)
Combination Lookup
$ ("#i1,. C1,a")
Hierarchy Selector
Find all the A tags under the label with ID I1
$ ("#i1 a")
Find all the sub-labels for the A label under the tag with ID I1
$ ("#i1 >a")
Find by property
$ (' [alex= ' 123 "] ')
Basic filters
: The first label matches the criteria
: not$ () do not select a label under this condition
: Even satisfies the condition and is an even row of labels
: Odd satisfies the criteria and is an odd line of labels
: EQ (index) Filtered by index, index starting from 0
: The last label meets the criteria
Filter
. Next () The next label of the current label
. Nextall () All tags of sibling after current label
. Nextuntil () All sibling labels before the current label to the specified position
. Prev () Previous label of the current label
. Prevall ()
. Prevuntil ()
The parent label of the current tag of the. Parent ()
. Parents ()
. Parentsuntil ()
. Children the child label of the current label
. Siblings () The Brother label of the current label
. Find () Look for eligible sub-labels under the Object tab
. EQ () Select a label
. First ()
. Last ()
Does the. Hasclass (Class) have a style
Cycle
. each () Single element action alone
Add a style. AddClass ()
Remove the style. Removeclass ()
The style exists on the cancel, does not exist on the Add. Toggleclass ()
. attr () A parameter gets the property value, two parameters set the property value
. Removeattr ()
. Prop () Checkbox,radio property operation
. Index () Gets the label index
. Append () adds a sub-label at the end of the specified label
. prepend () adds a sub-label to the head at the lower level of the specified label
. After () add a sibling tag after the label is specified
. before () add a sibling tag before the specified label
. Remove () Delete label
. Empty () empty label value
. Clone () Copy label contents
. CSS () to set a single CSS style
Gets the text. Text () Add parameter setting new content
Get all content. HTML ()
Gets the value. val ()
Chained programming a jquery object can always be added. Operation
string concatenation "" + ""
. Offset gets the coordinates of the specified label
. Top () coordinates
. Left () coordinates
. Position () with Relative,absolute, gets the coordinates of the specified label relative to the parent tag,
. Height () Gets the height of the specified label
. Innerheight () Get label and padding height
. Outerheight (), gets the label and padding and the height of the border, when the parameter is true, gets the height of the label and the inner and outer margins and the border
Binding events
1.click ()
2.bind ("", function)
. Unbind ("", function)
3.delegete ("label", "", function)
. Undelegete ("label", "", function)
4.on ("", function)
. Off ("", function)
Event priority
Custom event priority is higher than the default event
onclick= "Return Clickon ()"
If the return value is false, no subsequent events are performed, and the direct function returns false in jquery
$ (function) executes this function when the page frame has finished loading
jquery Extension Customization method
$.extend ("Custom method Name": function)
$. Custom method Name ()
$.fn.extend ("Custom method Name": function)
$ (). Custom method Name ()
The jquery extension method needs to be encapsulated using a self-executing function that puts the extended code inside the word execution function body
17th Day of Python Learning