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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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});