Given a textarea
element:
<textarea></textarea>
Input
To get the textarea value on input event:
document.querySelector('textarea').addEventListener('input', function (event) {
console.log(event.target.value);
});
This logs the value every time the value changes.
Change
To get the textarea value on change event:
document.querySelector('textarea').addEventListener('change', function (event) {
console.log(event.target.value);
});
This logs the value after the textarea element loses focus.