Skip to content

Instantly share code, notes, and snippets.

@BolajiAyodeji
Last active March 31, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BolajiAyodeji/f9d728fc405f63a881ee5eaa90e3b3e1 to your computer and use it in GitHub Desktop.
Save BolajiAyodeji/f9d728fc405f63a881ee5eaa90e3b3e1 to your computer and use it in GitHub Desktop.
const input = document.getElementById('lbsInput');
const output = document.getElementById('output');
output.style.visibility = 'hidden';
input.addEventListener('input', (e) => {
let lbs = e.target.value;
output.style.visibility = 'visible';
let grams = document.getElementById('gOutput');
grams.innerHTML = lbs/0.0022046;
let kiloGrams = document.getElementById('kgOutput');
kiloGrams.innerHTML = lbs/2.2046;
let ounces = document.getElementById('ozOutput');
ounces.innerHTML = lbs*16;
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment