I have a jQuery change
event for when a user changes a given SELECT
element. However the event may also be triggered by a third party script. What I want to do is detect whether the event was triggered programmatically or by the user.
I have tried the accepted solution in this question Check if event is triggered by a human
But note the JSFiddle in this answer is for a click
event rather than a change
event.
To demonstrate I amended the fiddle and created this one: http://jsfiddle.net/Uf8Wv/231/
If you try this in latest Firefox or Chrome, you will see that the alert human
is being shown even when the event was triggered programmatically.
I have tried event.originalEvent.isTrusted
but that doesn't work in all browsers. Can anyone help?