2022.2

Table Of Contents
}
});
Thiscodeisusedinascriptthatinsertsatableofcontents.Forthefullscriptandexplanationsee
"CreatingaTableOfContents"onpage852.
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');
}
height()
Getsorsetstheouterheight,includingpaddingandborders,ofanHTMLelement,orofthefirstele-
mentinaresultset(see"results"onpage1301),i.e.thesetofHTMLelementsthatmatchtheselector
ofthescriptorofanotherqueryinthetemplate(see"query()"onpage1197).
height(): Number
Returnstheouterheightofthiselement,includingpaddingandborders,excludingmargins.Toinclude
margins,callheight(true).
Thereturnedvalueistheheightinpixels,withoutmeasurementunit(e.g.400).
height(value): void
Setstheouterheightofthiselement,includingpaddingandborders,excludingmargins.Toinclude
margins,callheight(value, true).
value
Number.Givetheheightinpixels,butwithoutthemeasurementunit(e.g.400,not400px).
Page 1222