2022.2

Table Of Contents
Examples
Thefollowingscriptloadspartofasnippetbasedonthevalueofafield,andtheninsertsthecontent
intothedocumentusinghtml().
var promoTxt = loadhtml('snippets/promo-en.html', '#' + record.fields['YOGA']);
results.html(promoTxt);
Thefollowingscriptloadsasnippet.Thenitlooksforaplaceholder(@var2@)inthetextofthatsnippet
andreplaceseveryfoundplaceholderbythetext'<i>OLConnect1</i>'.Ituseshtml()sotheHTML
formatting(<i>and</i>)willindeedbeinterpretedasHTML.Finally,itplacesthesnippetinthetem-
plate.
var mysnippet = loadhtml('snippets/snippet.html');
mysnippet.find('@var1@').html('<i>OL Connect 1</i>');
results.replaceWith(mysnippet);
info()
ReturnspaginationinformationforoneHTMLelementorforthefirstelementinaresultset(see"res-
ults"onpage1301)ofaqueryacrossallsectionsinaPrintcontext(see"query(selector)"on
page1300).
ThereturnedinformationisofthetypePaginationInfo(see"PaginationInfo"onpage1300).
ThisfunctioncanonlybeusedinaPostPaginationScript;see"PostPaginationScriptAPI"on
page1297.
Foranexamplesee:"CreatingaTableOfContents"onpage852.
next()
next()returnsthenextsiblingofanHTMLelement,whichcanbe:
l
Theelementsthatmatchtheselectorofascript(see"results"onpage1301).
l
Oneelementthatmatchestheselectorofascriptthatrunsfor"Eachmatchedelement"(see
"this"onpage1237and"Settingthescopeofascript"onpage813).
l
Theelementsreturnedbyaqueryinthetemplate(see"query()"onpage1197).
InHTML,siblingsareHTMLelementsthatsharethesameparent,i.e.HTMLelementsinthesamecon-
tainerelement.
Notethatasiblingcanbeadifferenttypeofelement.Forexample,ifaparagraph,animageandatable
followeachotherinthesameBox,theyaresiblings.
Tip: Togettheprevioussibling,useprevious()(see"prev()"onpage1264).
Page 1258