<div class="container">
  <input type="text" id="input">
  <div id="out"></div>
</div>
html {
  background-color: #000;
  color: #ccc;
}

input {
  background-color: #ccc;
}
function main() {  
}

window.addEventListener("load", () => {
  document.getElementById("input").addEventListener("keydown", (e) => {
    if (e.key === "Enter") {
      const log = document.createElement("p");
      log.classList.add("log");
      log.innerText = `${Date.now()}: Enterおしたね`;
      document.getElementById("out").prepend(log);
    }
  });
})
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.