leanwebclub/js-essentials/character-count/script.js

7 lines
214 B
JavaScript

let counter = document.querySelector("#character-count");
let textarea = document.querySelector('#text');
textarea.addEventListener('input', function (event) {
counter.innerText = event.target.value.length;
});