html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<textarea name="" id="a" cols="30" rows="10"></textarea>
<textarea name="" id="b" cols="30" rows="10"></textarea>
<textarea name="" id="c" cols="30" rows="10"></textarea>
</body>
</html>
js
const first = document.getElementById("a");
const second = document.getElementById("b");
const third = document.getElementById("c");
first.addEventListener("input", () => {
second.value = first.value;
});
second.addEventListener("change", () => {
console.log("work!!")
third.value = second.value;
});
codepen -> https://codepen.io/dmgpgdmgpg/pen/NWRxVbg?editors=1111
first -> second is okay but second -> third is not work
because The change event is fired for input, select, and textarea elements when a change to the element's value is committed by the user. (MDN)
how can detect change of second textarea after change of first textarea?
i want pass first to second, second to third (not first -> third)