1.5

Table Of Contents
var box = query("#box");
box.prepend("<p>Peter Parker</p>");
box.css("color","red");
query()
This function creates a new result set, containing the HTML elements that match the supplied
CSS selector. The context (optional) allows you to restrict the search to descendants of one or
more context elements.
l query(selector)
l query(selector, context)
The new result set is of the type QueryResults. All functions that can be used with the results
object can also be used with this result set; see "results" on page467.
query(selector)
Creates a new result set containing the HTML elements in the template that match the supplied
CSS selector.
selector
A String containing a CSS selector. See http://www.w3schools.com/cssref/css_selectors.asp
for CSS selectors and combinations of CSS selectors.
query(selector, context)
Creates a new result set containing the HTML elements that match the supplied CSS selector.
The context (optional) allows you to restrict the search to descendants of one or more context
elements.
selector
A String containing a CSS selector. See http://www.w3schools.com/cssref/css_selectors.asp
for CSS selectors and combinations of CSS selectors.
context
A result set or an HTML string. If the passed context is not a result set of HTML string it will be
coerced to a String and interpreted as HTML.
Page 462