Weight Converter debugging

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

03-Sep-17 11:30
Hello. I was making Weight Converter (using tutorial) that should convert pounds to grams, kilograms and ounces and it was working yesterday. But today it just converting grams.
Here is a code:


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<style>
body {
margin-top: 70px;
background: #333;
color: #fff
}
</style>
<title>Weight Converter</title>
</head>
<body>
<div call="container">
<div class="row">
<div class="col-md-6 offset-md-3">
<h1 class="display-4 text-center mb-3">Weight Converter</h1>
<form>
<div class="form-group">
<input id="lbsInput" type="number" class="form-control form-control-lg" placeholder="Enter Pounds">
</form>
<div id="output">
<div class="card card-primary">
<div class="card-block">
<h4>Grams: </h4>
<div id="gramsOutput">
</div>
</div>

<div class="card card-success">
<div class="card-block">
<h4>Kilograms: </h4>
<div id="kgkOutput">
</div>
</div>

<div class="card card-danger">
<div class="card-block">
<h4>Ounces: </h4>
<div id="ozOutput">
</div>
</div>
</div>
</div>
</div>
</div>


<script>
document.getElementById('output').style.visibility = 'hidden';
document.getElementById('lbsInput').addEventListener('input', function(e) {
document.getElementById('output').style.visibility = 'visible';
let lbs = e.target.value;
document.getElementById('gramsOutput').innerHTML = lbs/0.0022046;
document.getElementById('kgOutput').innerHTML = lbs/2.2046;
document.getElementById('ozOutput').innerHTML = lbs*16;
});
</script>
</body>
</html>
06-Sep-17 09:29
"it was working yesterday. But today it just converting grams."

And what changed in between those times?

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/

 
New posts
Old posts

Follow Elated