TAG
JavaScript
Result
Run
License
<input type="text" id="input1" /> <input type="text" id="input2" /> <p id="output"></p>
window.addEventListener("load", e => { const elOutput = document.getElementById("output"); const aElInputs = document.querySelectorAll("input"); aElInputs.forEach(elInput => { elInput.addEventListener("keydown", e => { elOutput.textContent = e.target.value; }); }); }); window.addEventListener("keydown", function(e) { console.log(`Event fired from ${e.target.id}`); });
Console
expand_less
License
License
by DevDic
Close