Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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();
});
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('../sw.js').then( () => {
console.log('Service Worker Registered')
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.