how to detect input value change by javascript observe

Solutions on MaxInterview for how to detect input value change by javascript observe by the best coders in the world

showing results for - "how to detect input value change by javascript observe"
Alejandra
05 Apr 2020
1function changeValue (event, target) {
2    document.querySelector("#" + target).value = new Date().getTime();
3}
4 
5function changeContentValue () {
6    document.querySelector("#content").value = new Date().getTime();
7}
8 
9Object.defineProperty(document.querySelector("#content"), "value", {
10    set:  function (t) {
11        alert('#changed content value');
12        var caller = arguments.callee
13            ? (arguments.callee.caller ? arguments.callee.caller : arguments.callee)
14            : ''
15 
16        console.log('this =>', this);
17        console.log('event => ', event || window.event);
18        console.log('caller => ', caller);
19        return this.textContent = t;
20    }
21});