input event listener fires only when we type something in input, want to fire the event on click of button when values changes from outside
const currentValue = document.querySelector('#currentValue');
currentValue.addEventListener('input', function () {
// This one fires only when we type something in input, want to fire this on click of button when values changes from outside
console.log("Input alue changed!!");
});
function myFunction() {
console.log("Button Clicked..");
currentValue.value = 3;
}
<input type="text" id="currentValue" value="1"/>
<button onclick="myFunction()">Test</button>