toUnit

Converts the current value with a measurment unit to another measurement unit. For example, this method can convert the value 1kg to 2.2lb or 1000g.

See also unit.

Syntax

toUnit(newUnit)

Parameter

Description

newUnit

The new measurement unit (must be a string).

Examples

Converts the value from meters to centimeters:

$('HEIGHT').unit('m').toUnit('cm')

Converts the value from its current unit to centimeters (the current unit is take from the unit property of the HEIGHT variable):

$('HEIGHT').toUnit('cm')