2022.2

Table Of Contents
width(value): void
Setstheouterwidthofthiselement,includingpaddingandborders,excludingmargins.Toincludemar-
gins,callwidth(value, true).
value
Number.Givethewidthinpixels,butwithoutthemeasurementunit(e.g.400,not400px).
Examples
Thisscriptadds20pixelstothewidthandheightofanelement.
var h = results.height();
var w = results.width();
h = h + 20;
w = w + 20;
results.height( h );
results.width( w );
Thefollowingscriptdoesthesame,butinthiscase,marginsareincluded.
var h = results.height(true);
var w = results.width(true);
h = h + 20;
w = w + 20;
results.height( h, true);
results.width( w, true);
translate()
Whenatemplatehasbeenpreparedtousethetranslationfeature(see"Translatingtemplates"on
page856),thisfeatureisalsoaccessibleviaatemplatescript.
Thetranslate()functiongetsthetranslationforamessage,providedthatatranslationentrycanbe
foundforit(withthesamecontext,ifgiven).
Ifthetexttobetranslateddoesnotalreadyexistinthetemplate,youcancreateatranslationentryforit
byusingtheAdd Empty Stringbuttononthe"Translationspane"onpage986.
Notethatcallingthetranslate()functionmaybeunnecessaryifascriptaddstexttoanelement
thathasthedata-translateattribute;see"Taggingtextthatisinsertedbyascript"onpage859.In
thatcase,anyexistingtranslationwillbeappliedautomatically.
translate(message, context)
Thetranslate()functiongetsthetranslationofasourcetextwithan(optional)context.Itreturns
themessageas-isifnotranslationisfound.
message
Page 1270