I have a form where elements such as input
and select
can be updated in many different ways (user entry, copy/paste, select options added or removed programmatically, value updated programmatically, autocomplete). Rather than trying to catch all these actions, I'd rather observe changes to the element properties.
The easiest way is to rely on the propertychange
event, unfortunately it only works on IE 10 and below.
What are my options for IE 11 and other browsers like Chrome? I have heard of methods like Object.defineProperty
for objects, but I am not sure how it would apply to my form elements. I also looked into mutation observers
, but I don't see how they would help with input elements.
Any pointers would be appreciated.
[edit] I am getting comments that this question is too broad. I understand, and I was actually hoping that there's already a clear answer, as it seems to me that it's such a common request.
To make it more specific, here is the immediate issue I have to deal with: how to detect a programmatic change to an input element value, in IE 11 and Chrome?