I have one HTML input element.
<input type = "hidden" name = "MY_ELEMENT" id = "MY_ELEMENT" />
The element is not having any value initially.
There is one JavaScript function which will set the value of the input element. I want to execute another JavaScript function the moment the input element gets the value. It is certain that the said element will get some value but that can take some time.
I tried using the while loop but that made the page unresponsive. I want the function anotherJSFunction() to run after the input element gets some value.
while(document.getElementById("MY_ELEMENT").value == "") {
console.log('Waiting for the element to get some value.');
}
anotherJSFunction();
Please suggest some alternatives for this problem.