2022.2

Table Of Contents
Selector Paragraph
before script
execution
Paragraph after script
execution
span <p>Loremipsum<span>-
dolorsit</span>amet,con-
sectetueradipiscingelit.</p>
<p>Loremipsum<span></span>amet,
consectetueradipiscingelit.</p>
find()
find(textToFind)
PerformsadeepsearchfortextToFindinthechildrenofeachelement,andreturnsanewresultset
withelementsthatsurroundtheoccurrences.
textToFind
AStringthatcontainsthesearchtext.
Example
Thefollowingpieceofcodeloadsasnippet,thenlooksforplaceholdersusingfind(),andreplacesthem
withatext.
var mysnippet = loadhtml('snippets/snippet.html');
mysnippet.find('@var1@').text('OL Connect 1');
mysnippet.find('@var2@').html('<i>OL Connect 2</i>').css('text-decoration','underline');
results.replaceWith(mysnippet);
hasClass()
hasClass(classname) : Boolean
ReturnstrueiftheHTMLelementorthefirstelementinaresultsethasthespecifiedclass.
classname
Stringcontainingoneclassname.
Example
Thisscriptchecksifthefirstoftheresults(thesetofelementsmatchingtheselectorofthescript)
hastheclass'green'.Ifso,itcolorsthetextofalltheelementsintheresults green.
if (results.hasClass('green')) {
results.css('color', 'green');
}
Page 1255