2022.1

Table Of Contents
var snippet = loadhtml('snippets/mysnippet.html');
query("#foo", snippet).text("bar");
results.replaceWith(snippet);
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 https://www.w3schools.com/cssref/css_selectors.asp
for CSS selectors and combinations of CSS selectors.
context
A result set (the result of another query) or an HTML string. If the passed context is not a result
set or HTML string it will be coerced to a String and interpreted as HTML.
Examples
This script performs a query in the results of another query.
var table = query("table");
var rows = query("tr", table);
var cells = query("td", rows);
Since the results object also is the result of a query (for elements that match the selector of the
script), it can be passed as context. For example in a script with the selector “table”.
var rows = query("tr", results);
query(html)
Creates a new HTML element on the fly from the provided string of raw HTML, and returns the
new element.
html
A String containing a HTML element. Tags that can contain other elements should be paired
with a closing tag.
Page 1380