i did this code so I could mirror textareas:
<body>
<textarea class="caixa1"></textarea>
<textarea class="caixa2"></textarea>
<br>
<textarea class="caixa1"></textarea>
<textarea class="caixa2"></textarea>
<script>
var a = document.getElementsByClassName("caixa1");
var b = document.getElementsByClassName("caixa2");
a[0].oninput = function(e) {
b[0].value = a[0].value;
}
b[0].oninput = function(e) {
a[0].value = b[0].value;
}
a[1].oninput = function(e) {
b[1].value = a[1].value;
}
b[1].oninput = function(e) {
a[1].value = b[1].value;
}
</script>
</body>
But I need to repeat this 8 times. Is there any way I could create a variable that changes according to the class index of the current textarea?