1.6

Table Of Contents
["ItemNumber"]);
row.find('@ItemOrdered@').text(record.tables['detail'][i].fields
["ItemOrdered"]);
row.find('@ItemTotal@').text(record.tables['detail'][i].fields
["ItemTotal"]);
row.find('@ItemDesc@').text(record.tables['detail'][i].fields
["ItemDesc"]);
row.find('@nr@').text(i );
results.parent().append(row);
}
// Hide our boilerplate row (note that this doesn't really delete
the row).
results.hide();
closest()
For each element in a set, this function gets the first parent element that matches a selector, by
testing the element itself and traversing up through its ancestors in the DOM tree. (In HTML, a
parent is an element that contains another element.)
To get a child element or all child elements, use children() (see "children()" on page755).
The closest() command is based on the closest() command found in the jQuery library:
https://api.jquery.com/closest/.
closest(selector)
For each element in a set, this function gets the first element that matches the selector by
testing the element itself and traversing up through its ancestors in the DOM tree.
selector
A String containing an HTML tag (without the angle brackets, <>).
Examples
The following script looks up all table rows in the template that contain an <input> element.
query("input").closest("tr");
Page 758