JSFiddle - React, Tailwind, and code Playground
HTML
<form name="formX">
<input name="dept" value="something">
<input name="apflag" value="else">
</form>
<p>You typed <i id="both"></i> above.</p>
CSS
i {
background-color: pink;
}
JavaScript
function handler()
{
document.getElementById('both').textContent = document.formX.dept.value + document.formX.apflag.value
}
document.addEventListener('keyup', handler)
handler()