Question: I have a simple conversion form from kg to lbs.

**html**

```
<input type="text" id="kg" name="kg">
<input type="text" id="lbs" name="lbs">

```

I have it setup so that the lbs box updates while you type in the kg box with this code.

**jQuery**

```
$("#kg").keyup(function(){
    $('#lbs').val($('#kg').val()*2.20462);
});

```

How do I get the lbs value to round to 2 decimals places? I am sure it is something fairly simple but all the examples I found online are for if the number is stored in a variable.

Answer: 
Use [toFixed](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed)

```
var string = yourNumber.toFixed(2);

```
also this

```
(10.8).toFixed(2); // 10.80

var num = 2.4;
alert(num.toFixed(2)); // 2.40

```

[Formatting a number with exactly two decimals in JavaScript](https://stackoverflow.com/questions/1726630/javascript-formatting-number-with-exactly-two-decimals)