2

There's a third-party js-code, which changes my inputs values like this:

some_third_party_func = function() { 
    my_input.value = some_val;
};

I want to track all the changes of my_input.value somehow. Modifying a third-party js is the thing I want to avoid. Probably, events can be useful, but which one? The oninput event looks acceptable, except for handling only keyboard input because of some mysterious reasons.

my_input.oninput = function() { alert("my_input.oninput"); };
// ^^ alert() runs only when inputting from the keyboard 

Here you can try the issue (how it looks for me).

Is there any method to do this (with jQuery, maybe)?

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
Timushev Roman
  • 333
  • 3
  • 12
  • 1
    There is no event raised when the value property of an input is change programmatically. To do what you need you would have to change the source of the plugin to `trigger()` a `change` event. – Rory McCrossan Nov 02 '15 at 15:58
  • 1
    my google == your google: http://stackoverflow.com/questions/1063813/listener-for-property-value-changes-in-a-javascript-object – Alex Nov 02 '15 at 16:08
  • 1
    also wicked: http://www.html5rocks.com/en/tutorials/es7/observe/ – Alex Nov 02 '15 at 16:10
  • Sad situation. Yes. My search skills are extremely basic. – Timushev Roman Nov 02 '15 at 16:10
  • 1
    polyfill for watch: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/watch resp. https://gist.github.com/eligrey/384583 – Alex Nov 02 '15 at 16:11

0 Answers0