JQuery (expression,
[Context]) return value: jquery overview
This function receives a string that includes a CSS selector and then uses that string to match a set of elements.
The core functionality of JQuery is achieved through this function. Everything in jquery is based on this function, or the function is used in some way. The main use of this function is to pass an expression (usually composed of a CSS selector) to it, and then find all the matching elements based on the expression.
By default, if a context parameter is not specified, $ () looks for the DOM element in the current HTML document; If a context parameter is specified, such as a DOM element set or a JQuery object, it will be found in this context. After jquery 1.3.2, the order of elements returned is equivalent to the order in which they appear in the context.
The selector section of the reference document gets many other information about the CSS syntax for expression parameters.
Number of references
expressionString
The string to find
context (optional) Element, JQuery
As a set of DOM elements, a document, or a JQuery object to be found.
Demo sample Descriptive narrative:
All P elements are found, and the elements must be child elements of the DIV element.
HTML Code:
<p>one</p> <div><p>two</p></div> <p>three</p>
JQuery Code:
$("div > p");
Results:
[ <p>two</p> ]
Descriptive narrative:
In the first form of the document, look for all the radio buttons (that is, the input element with the type value radio).
JQuery Code:
$("input:radio", document.forms[0]);
Descriptive narrative:
In an XML document returned by AJAX, find the entire DIV element.
JQuery Code:
$("div", xml.responseXML);
jquery (expression, [context]), $ (that is, jquery), question of the number of parameters