JSFiddle - React, Tailwind, and code Playground
HTML
<p><input id="input1" type="text" value="1"></p>
<p><input id="input2" type="text" value="2"></p>
<p><input id="input3" type="text" value="3" onkeyup="kbHandler(event)"></p>
JavaScript
function kbHandler(e) {
if (e.keyCode != 13) alert(e.keyCode);
}
window.onload = function() {
document.getElementById('input1').onkeyup = kbHandler;
document.getElementById('input2').onkeyup = function(e) {
kbHandler(e);
};
}