I am writing a JS event listener to hide button if the entered value in a text field is true:
const item = document.getElementById("my-field");
item.addEventListener("input", function (evt) {
if (item.value == "true") {
document
.getElementById("my-button")
.setAttribute("style", "display: none;");
}
});
This works fine if I manually add this value, but I have another JS function (running as a part of chrome extension) that does it. The eventListener doesn't work then. Any idea how can I make this work when a JS code is inputting the value?