Niche Summary: Novice must-see jquery reference manual Main API

Source: Internet
Author: User
Tags http post prev

This article has compiled some of the major jquery APIs, including jquery core functions and methods, jquery Property reference manuals, jquery CSS operations, jquery selectors, jquery document operations, jquery filtering operations, jquery event methods, jquery effects, jquery ajax operations, jquery tool functions, jquery event objects, jquery delay objects, jquery callback functions, welcome to the collection.
jquery core Functions
function Description
jQuery () This function receives a string containing a CSS selector and then uses that string to match a set of elements.
jquery () 1.8* dynamically creates DOM elements wrapped by jquery objects based on the supplied original HTML tag string. Set up a series of properties, events, and so on.
JQuery () $ (document) shorthand for Ready ().
Jquery.holdready () 1.6+ pause or resume the execution of the. Ready () event.
each () executes a function with each matching element as the context.
size () The number of elements in the JQuery object.
the number of elements in the length JQuery object.
Selector Returns the original selector passed to jquery ().
The context returns the original DOM node content passed to jquery (), which is the second parameter of jquery (). If not specified, then the context points to the current document.
get () gets one of the matching elements. Num represents the element that gets the first few matches.
index () searches for the matching element and returns the index value of the corresponding element, counting from 0.
data () is stored on the element and returns the JQuery object.
removedata () 1.7* remove the stored data on the element
Queue () displays or operates function queues that are executed on matching elements
dequeue () removes a queue function from the front of the queue and executes it.
Clearqueue () empties all queues on the object that have not yet been executed
JQuery.fn.extend () extends the set of jQuery elements to provide new methods (often used to make plugins).
Jquery.extend () extends the JQuery object itself.
Jquery.noconflict () runs this function to pass control of the variable $ to the first library that implements it.
jquery Properties

function Description
attr () Sets or returns the property value of the selected element.
removeattr () removes an attribute from each of the matched elements
prop () 1.6+ Gets the property value of the first element in the matching element set.
the Removeprop () 1.6+ is used to delete the set of properties that are sets by the. Prop () method
addclass () adds the specified class name for each matching element.
removeclass () removes all or the specified classes from all matching elements.
Toggleclass () deletes (adds) a class if it exists (does not exist).
HTML () Gets the HTML content of the first matching element. This function cannot be used with XML documents. But it can be used in XHTML documents.
text () Gets the contents of all matching elements.
Val () Gets the current value of the matching element.
jQuery CSS Operations

These methods are listed below to set or return the element's CSS-related properties.

function Description
css () 1.9* accesses the style attributes of the matching element.
Jquery.csshooks adds a hook directly to JQuery to override the method used to set or get a particular CSS property, either to standardize the CSS property name or to create a custom property.
offset () Gets the relative offset of the matching element at the current viewport.
position () Gets the offset of the matching element relative to the parent element.
scrolltop () Gets the offset from the top of the scrollbar relative to the element.
scrollleft () Gets the offset to the left of the matching element relative to the scrollbar.
Heigh () Gets the height value (px) of the current calculation of the matching element.
Width () Gets the value (px) of the current calculation for the first matching element.
Innerheight () Gets the inner area height of the first matching element, including padding, excluding borders.
innerwidth () Gets the inner area width of the first matching element, including padding, excluding borders.
Outerheight () Gets the outer height of the first matching element (including padding and borders by default).
Outerwidth () Gets the outer width of the first matching element (including padding and borders by default).
jquery Selector

function Description
#id
element
. Class
*   
Selector1,selector2,selectorn
ancestor descendant
Parent > Child
prev + Next
Prev ~ siblings
: First
: Not ()
: Even
: Odd
: eq ()
: GT ()
: lang1.9+
: Last
: LT ()
: Header
: Animated
: focus1.6+
: root1.9+
: target1.9+
: Contains ()
: Empty
: Has ()
:p arent
: Hidden
: Visible
[attribute]
[Attribute=value]
[Attribute!=value]
[Attribute^=value]
[Attribute$=value]
[Attribute*=value]
[Attrsel1][attrsel2][attrseln]
: First-child
: first-of-type1.9+
: Last-child
: last-of-type1.9+
: Nth-child
: Nth-last-child () 1.9+
: Nth-last-of-type () 1.9+
: Nth-of-type () 1.9+
: Only-child
: only-of-type1.9+
: Input
: Text
:p Assword
: Radio
: CheckBox
: Submit
: Image
: Reset
: Button
: File
: Hidden
: Enabled
:d isabled
: Checked
: Selected
jquery Document Operations

function Description
append () appends content to each matching element.
AppendTo () appends all matching elements to another specified set of element elements.
prepend () to each matched element within the predecessor content.
prependto () puts all matching elements in front of another, specified set of element elements.
after () inserts the content after each matching element.
before () inserts the content before each matching element.
InsertAfter () inserts all matching elements behind another, specified set of element elements.
InsertBefore () inserts all matching elements in front of another, specified set of element elements.
Wrap () wraps all matching elements with a structured tag of other elements.
Unwrap () This method moves the parent element out of the element.
Wrapall () wraps all matching elements together with a single element
Wrapinner () wraps the child content of each matching element (including the text node) with an HTML structure.
replacewith () replaces all matching elements with the specified HTML or DOM element.
ReplaceAll () replaces all selector matching elements with matching elements.
empty () deletes all the child nodes in the matching element collection.
Remove () removes all matching elements from the DOM.
detach () removes all matching elements from the DOM.
Clone () clones the matching DOM elements and selects copies of those clones.
jquery filtering Operations

function Description
eq () gets the nth element
first () gets the number one element
last () gets the final element
Hasclass () checks whether the current element contains a particular class, and returns True if any.
filter () filters out the collection of elements that match the specified expression.
is () 1.6* detects a collection of matching elements based on selectors, Dom elements, or jQuery objects. Jiangxi Seo thinkreturns True if at least one of the elements conforms to the given expression.
map () converts a set of elements into other arrays (whether or not an array of elements)
has () retains elements that contain specific descendants, removing those elements that do not contain the specified descendants.
Not () deletes the element that matches the specified expression
Slice () pick a matching subset
children () gets a collection of elements that contain all the child elements of each element in the matching element collection.
closest () 1.7* begins with the element itself, successively matches the ancestor element, and returns the first matching element.
find () 1.6* searches for all elements that match the specified expression. This function is a good way to find out the descendant elements of the element being processed.
next () gets a collection of elements that contain a matching set of elements that are immediately behind each element in the next sibling element.
Nextall () finds all sibling elements after the current element.
Nextuntil () 1.6* finds all sibling elements after the current element until the matching element is encountered.
offsetParent () returns the parent node that the first matching element is used for positioning.
parent () gets a collection of elements that contain the unique parent element for all matching elements.
parents () gets a collection of elements (without root elements) that contains the ancestor elements of all matching elements. You can filter by an optional expression.
Parentsuntil () 1.6* finds all the parent elements of the current element until it encounters the matching element.
prev () gets a collection of elements that contain the first sibling element that is immediately adjacent to each element in the matching element collection.
Prevall () finds all sibling elements before the current element
Prevuntil () 1.6* finds all sibling elements before the current element until the matching element is encountered.
siblings () gets a collection of elements that contain all the unique sibling elements of each element in the matching element collection. You can filter by using an optional expression.
Add () adds the element that matches the expression to the jquery object. This function can be used to concatenate the result set of an element that matches two expressions respectively.
andself () adds a previously selected join in the current element
contents () Finds all child nodes (including text nodes) within the matching element. If the element is an IFRAME, find the document content
end () back to the most recent "destructive" operation. That is, the list of matched elements changes to the previous state.
jquery Event Method

function Description
ready () binds a function to execute when the DOM is loaded in readiness to be queried and manipulated.
on () 1.7+ an event handler that is bound to one or more events on the selection element.
off () 1.7+ an event handler that removes one or more events on the selection element.
bind () binds event handlers for specific events of each matching element.
one () binds a single-pass event handler for a specific event (like click) for each matching element.
trigger () triggers a class of events on each matched element.
Triggerhandler () This particular method will trigger the handler function for all bindings on the specified event type. Shanghai SEO believes but does not perform browser default actions and does not generate event bubbling.
unbind () The reverse operation of BIND () removes the bound event from each matching element.
Live () 1.7-jquery attaches an event handler to all matching elements, even if the element is added later.
Die () 1.7-Removes all events previously bound with. Live () from the element. (This method is exactly the opposite of live.) )
delegate () The specified element (which is a child of the selected element) adds one or more event handlers and specifies the function to run when these events occur.
undelegate () 1.6* deletes one or more event handlers added by the delegate () method.
hover () a method that mimics the hover event (moving the mouse over an object and moving out of the object).
Toggle () is used to bind two or more event handler functions in response to the selected element's rotation click event.
blur () triggers the blur event when the element loses focus.
Change event occurs when the value of an element changes.
Click () triggers the Click event for each matching element.
DblClick () The DblClick event occurs when you double-click an element.
Error () The Error event occurs when an element encounters an error (not loaded correctly).
Focus () triggers a focus event when the element has the focus.
Focusin () triggers the Focusin event when the element receives focus.
focusout () triggers the Focusout event when the element loses focus.
KeyDown () The KeyDown event occurs when the keyboard or button is pressed.
keypress () The KeyPress event occurs when the keyboard or button is pressed.
KeyUp () The KeyUp event occurs when the button is released. It occurs on the element that is currently gaining focus.
MouseDown () The MouseDown event occurs when the mouse pointer moves over the element and the mouse button is pressed.
MouseEnter () The MouseEnter event occurs when the mouse pointer crosses an element. This event is most often used in conjunction with the MouseLeave event.
MouseLeave () The MouseLeave event occurs when the mouse pointer leaves the element. This event is most often used in conjunction with the MouseEnter event.
MouseMove () The MouseMove event occurs when the mouse pointer moves through the specified element.
mouseout () The Mouseout event occurs when the mouse pointer moves away from the element.
mouseover () The MouseOver event occurs when the mouse pointer is over the element.
MouseUp () The MouseUp event occurs when the mouse button is relaxed on the element.
Resize () The Resize event occurs when the size of the browser window is resized.
Scroll () The Scroll event occurs when the user scrolls through the specified element.
Select () a Select event occurs when the text in the input element of the textarea or text type is selected.
Submit () A Submit event occurs when the form is submitted.
unload () Unload event occurs when the user leaves the page.
jquery effect

function Description
Show () shows hidden matching elements.
Hide () hides the displayed elements
Toggle () is used to bind two or more event handler functions in response to the selected element's rotation click event.
Slidedown () dynamically displays all matching elements by a height change (increasing downward), optionally triggering a callback function after the display is complete.
Slideup () dynamically hides all matching elements by a height change (decrease up), optionally triggering a callback function after the hide is complete.
Slidetoggle () Toggles the visibility of all matching elements through a height change, and optionally triggers a callback function after the switch is complete.
FadeIn () implements the fade-in effect of all matching elements by changing the opacity, and optionally triggers a callback function after the animation is complete.
FadeOut () fades the fade effect of all matching elements by changing the opacity and optionally triggers a callback function after the animation is complete.
FadeTo () Adjusts the opacity of all matching elements incrementally to the specified opacity, and optionally triggers a callback function after the animation is complete.
Fadetoggle () Switches the fade-in and fade-out effects of all matching elements by changing the opacity, and optionally triggers a callback function after the animation is complete.
animate () 1.8* functions for creating custom animations.
Stop () 1.7* stops all animations that are running on the specified element.
Delay () sets a delay to defer execution of items after the queue.
finish () 1.9+ stops the currently running animation, removes all queued animations, and completes all animations that match the element.
JQuery.fx.off closes all animations on the page.
JQuery.fx.interval Sets the display frame rate of the animation.
jQuery Ajax Operations

function Description
$.ajax () loads remote data over an HTTP request.
load () loads the remote HTML file code and inserts it into the DOM.
$.get () loads information through a remote HTTP GET request.
$.getjson () loads JSON data through an HTTP GET request.
$.getscript () loads and executes a JavaScript file via an HTTP GET request.
$.post () loads information through a remote HTTP POST request.
Ajaxcomplete () executes the function when the AJAX request completes. Ajax events.
Ajaxerror () an AJAX request executes a function when an error occurs. Ajax events.
Ajaxsend () an AJAX request to execute the function before sending. Ajax events.
Ajaxstart () executes the function at the beginning of the AJAX request. Ajax events.
Ajaxstop () executes the function at the end of the AJAX request. Ajax events.
ajaxsuccess () executes the function when the AJAX request succeeds. Ajax events.
$.ajaxprefilter () Handle custom Ajax options or modify existing options before each request was sent and before they are Processed by $.ajax ().
$.ajaxsetup () sets the global AJAX default option.
Serialize () serializes the table contents to a string.
Serializearray () serializes tabular elements (similar to the '. Serialize () ' method) to return the JSON data structure.

Niche Summary: Novice must-see jquery reference manual Main API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.