Vorbly Code | WIX CODE CONVERT NUMBERS TO 2 DECIMALS

Vorbly <Code>

CODING MADE EASY WITH VORBLY

WIX CODE CONVERT NUMBERS TO 2 DECIMALS

Need to convert numbers to 2 decimal places? This tutorial will show you how to convert numbers to 2 decimal places using Wix Code. You will be able to round-up or round-down numbers to 2 decimal places for calculations on your website. We will provide you with the webpage elements and sample codes required to implement this feature.

THE DEMO

1/2

THE ELEMENTS

The Page

User Input: #amount

 

Text Element: #Number​​

THE CODE

Page Code

$w.onReady(function () {

    $w('#Number').text = parseFloat($w('#amount').value).toFixed(2);

});

2 Decimal Places: ...toFixed(2)

3 Decimal Places: ...toFixed(3)

4 Decimal Places: ...toFixed(4)

...

COMMENTS

I'm a paragraph. Click here to add your own text and edit me. It's easy.

WEB DESIGN & DEVELOPMENT SOLUTIONS

GET PROFESSIONAL HELP