How To Convert From Grams To Pounds Using Javascript

admin_img Posted By Bajarangi soft , Posted On 27-11-2020

We can Convert from Grams to Pounds using formula Pounds =Grams *0.0022046 and we use this logical with javascript .So today we discuss how to convert from Grams to Pounds using javascript

how-to-convert-from-pounds-to-ounces-using-javascript

Complete Code For  Converting From Grams To Pounds Using Javascript.

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>How To Convert From Grams To Pounds Using Javascript</title>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<style>
    body {
        background: darkgrey;
    }

    h1 {
        color: white;
    }
</style>
<body>
<body>
<div class="container">
    <br/><br/>
    <div class="text-center">
        <h1 id="color" style="color: White;">Convert From Grams To Pounds Using Javascript</h1>
    </div>


    <div class="well">
        <p>
            <label>Grams</label>
            <input id="inputGrams" type="number" placeholder="Grams" oninput="weightConverter(this.value)" onchange="weightConverter(this.value)">
        </p>
        <p>Pounds: <span id="outputPounds"></span></p>

        <script>
            function weightConverter(valNum) {
                document.getElementById("outputPounds").innerHTML=valNum*0.0022046;
            }
        </script>
    </div>
</div>

</body>
</html>

Related Post