Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent input event from firing when changing textarea programmatically

I have a textarea that can be edited by the user. I occasionally update the text programmatically by changing the element's value property. I need an event that triggers when the user changes the text, but not when the program changes it. Is this possible?

like image 906
nonphoto Avatar asked Feb 11 '26 09:02

nonphoto


1 Answers

use keyup as the event trigger which will allow the user activity to trigger the function but not if you do it programmatically

addEvent(document.getElementById('textArea_id'), 'keyup', function(event) {
//function goes here
});
like image 176
gavgrif Avatar answered Feb 13 '26 22:02

gavgrif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!