children()
Returns the immediate children (inner HTML) of one or more HTML elements, which can be:
- The elements that match the selector of a script (see results).
- One element that matches the selector of a script that runs for "Each matched element" (see this and Setting the scope of a script).
- The elements returned by a query in the template (see query()).
Examples
This script retrieves the inner HTML of an element selected from a snippet.
Copy
var snippet = loadhtml('snippets/snippet.html','#foobar').children();
results.append(snippet);
The following script retrieves the inner HTML of the elements and then performs a find/replace.
Copy
var snippet = loadhtml('snippets/snippet.html','#foobar').children();
snippet.find('@firstname@').text('foobar');
results.append(snippet);