2022.2

Table Of Contents
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"onpage844),i.e.thesetofHTMLelementsthatmatchtheselectorof
thescriptorofanotherqueryinthetemplate(see"query()"onpage742).
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).
Examples
Thisscriptadds20pixelstothewidthandheightofanelement.
var h = results.height();
var w = results.width();
h = h + 20;
w = w + 20;
Page 799