Question : how to detect input value change by javascript observe
Answered by : muhibbullah-ansary
function changeValue (event, target) { document.querySelector("#" + target).value = new Date().getTime();
}
function changeContentValue () { document.querySelector("#content").value = new Date().getTime();
}
Object.defineProperty(document.querySelector("#content"), "value", { set: function (t) { alert('#changed content value'); var caller = arguments.callee ? (arguments.callee.caller ? arguments.callee.caller : arguments.callee) : '' console.log('this =>', this); console.log('event => ', event || window.event); console.log('caller => ', caller); return this.textContent = t; }
});
Source : https://stackoverflow.com/questions/32383349/detect-input-value-change-with-mutationobserver | Last Update : Sat, 09 Oct 21