JSFiddle - React, Tailwind, and code Playground
by Daniel Lizik
HTML
<div class="container">
<input id="in" />
<button onclick="foo('km/h')" >
km/h
</button>
<button onclick="foo('m/h')">
m/h
</button>
<pre id="out" />
</div>
JavaScript
let v;
let l;
window.foo = function(unit) {
l = unit;
console.log(unit)
}
document.querySelector('#in').addEventListener('change', ({ target: { value } }) => {
v = value;
const data = [
]
document.querySelector('#out').textContent = JSON.stringify(data, null, 2)
})