Is it possible to detect when a textarea value has been changed with JavaScript?
I know that event listeners for change
and input
can detect changes that the user makes but I'm trying to detect when the value has been changed programmatically.
Is there any other way to do this?
Example:
var area = document.getElementById('area');
area.addEventListener('input', function(){
alert();
});
area.value = "hi"; // Shouldn't it fire the alert here?
<textarea id="area"></textarea>