event listener for change during in javascript code example
Example 1: handling event changes
<p>This page turns violet when you hold the V key.</p>
<script>
window.addEventListener("keydown", event => {
if (event.key == "v") {
document.body.style.background = "violet";
}
});
window.addEventListener("keyup", event => {
if (event.key == "v") {
document.body.style.background = "";
}
});
</script>
Example 2: addeventlistener js select item
selectId.addEventListener("change", function() {
});