2022.2

Table Of Contents
Examples
Thisscriptcolorsthetextoftheresults(thesetofHTMLelementsthatmatchtheselectorofthe
script)redandmakesitbold.
results.css({'color' : 'red', 'font-weight' : 'bold'});
empty()
Removesthecontents(childelementsandinnerHTML)fromoneormoreHTMLelements,whichcan
be:
l
Theelementsthatmatchtheselectorofascript(see"results"onpage844).
l
Oneelementthatmatchestheselectorofascriptthatrunsfor"Eachmatchedelement"(see
"this"onpage781and"Settingthescopeofascript"onpage373).
l
Theelementsreturnedbyaqueryinthetemplate(see"query()"onpage742).
Use"remove()"onpage810toremovetheelementsthemselves.
Example
ThisscriptemptiesallSpanelementsfoundinthetemplate.
results.empty();
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>
filter()
filter(callback)
Returnsasubsetofaset.Allelementsforwhichthecallbackfunctionreturnstruewillbeincludedin
theresult.
callback
Page 763