JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="myInput" value="initial"/>
JavaScript
var myInput=document.getElementById("myInput");
// Observe programmatic changes
Object.defineProperty(myInput,"value",{
get:function(){return this.getAttribute("value");},
set:function(val){console.log("set "+val);this.setAttribute("value",val);}
});
// Observe manual changes
myInput.onchange=function(){console.log("change "+this.value);}
myInput.value="final";
console.log(myInput.value);