2022.2

Table Of Contents
ThepathtoaremoteHTMLsnippetcanbecopiedfromthesnippet'sproperties:right-clickthe
snippetintheResourcespaneandselectProperties.
Examples
ThisscriptloadsalocalHTMLsnippet(fromtheResourcespanel)directlyintothematchedelements
results.loadhtml("snippets/snippet.html");
ThefollowingscriptloadsalocalHTMLsnippet(Resourcespanel)intoavariable.ThereplaceWith()
commandisusedtoreplacetheelement(s)matchedbythescript'sselectorwiththecontentsofthe
snippet.
var mysnippet = loadhtml('snippets/snippet.html'); results.replaceWith(mysnippet);
Sameresultasthepreviousscript,butadifferentnotation:
results.replaceWith(loadhtml('snippets/snippet.html'));
Thefollowingscriptloadsasnippetintoavariableandfinds/replacestextinthevariablebeforeinsert-
ingthecontentintothepage.Thesecondfindcommandalsoaddsformattingtothereplacingtext.
var mysnippet = loadhtml('file:///C:/Users/PParker/Documents/Example.html');
mysnippet.find('@var1@').text('OL Connect 1');
mysnippet.find('@var2@').html('<i>OL Connect 2</i>').css('text-decoration','underline');
results.replaceWith(mysnippet);
Thislastscriptloadsaremotesnippetintoavariableandretrievesanelementfromthesnippetusing
query().
var mysnippet = loadhtml('http://www.somewebsite.com/text-root-wrapped.html');
var subject = query("#subject", mysnippet).text();
results.append("<p style='font-weight: bold;'>" + subject + "</p>");
loadhtml(location, selector)
RetrievesspecificcontentfromthespecifiedHTMLfile.
location
Stringcontainingapaththatcanbeabsoluteorrelativetothesection/context.
Usesnippets/<snippet-name>toretrievethecontentfromanHTMLfileresidingintheSnippets
folderontheResourcespanel.
Inordertoretrievefilesfromoutsidethetemplatethefileprotocolissupportedaswellasthe
Page 1183