HTML
<div class="item main">
<h1>Second Heading</h1>
<p>This is my second paragraph<br>
<input type="text" id="input">
<button id="kg">Convert to Kg</button><br><br>
<button id="pound">Convert to Pound</button>
<input type="text" id="output">
</div>
Javascript
let kgbtn = document.getElementById('kg');
let poundbtn = document.getElementById('pound');
/*This is my converter from KG to Pound*/
kgbtn.addEventListener('click', function() {
let input = document.getElementById('input').value;
document.getElementById('output').value = input / 2.205 + "kg";
})
/*This is my converter from Pound to KG*/
poundbtn.addEventListener('click', function() {
let input = document.getElementById('input').value;
document.getElementById('output').value = input * 2.205 + "Pound";
})
Can anyone please help me out with adding four decimals? I'm quite new to this javascript and would appreciate some help.