show()

Shows 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()).

To hide elements (again), use the function hide().

These functions are used by the Conditional Script Wizard, as you can see when you open a Conditional Script and click the Expand button; see Showing content conditionally.

Example

This script hides or shows the elements matched by the selector of the script (which are stored in the results object), depending on the value of the data field Country in the current record.

Copy
if (record.fields["Country"] == "CANADA") {
results.show();
} else {
results.hide();
}