1.8

Table Of Contents
Examples
This script removes all Span elements found in the template.
results.remove();
Selector Paragraph
before script
execution
Paragraph after
script execution
span <p>Lorem ipsum
<span>dolor
sit</span> amet,
consectetuer
adipiscing
elit.</p>
<p>Lorem ipsum
amet, consectetuer
adipiscing elit.</p>
The selector of the following sample script is tbody. Before this script runs, the table body
consists of a single placeholder row with three cells. After running the script, it contains thirty
rows. To improve performance, most of the DOM manipulation takes place on detached
elements.
// Detach the placeholder row from the DOM
var row = query("tr", results).remove();
// Modify the cells of this row
var cells = row.children();
cells[0].html("some text").css("background-color", "yellow");
cells[1].html("some text").css("font-weight", "bold");
cells[2].html("some text");
// Create a number of copies
var rows = row.clone();
for (var i = 0; i < 30; i++) {
rows = rows.add(row.clone());
}
Page 905