I want to trigger a function when one of my field (textbox) changed. The problem is: the content of that textbox is filed automatically by an external script(That I don't have access to), therefore the onChange listener won't trigger.
I've tried a lot of code, but here's the two closest (I think?) result I have:
Here's the script and the field
<script async src="SomeNiceScriptHere.js"></script>
<input type="text" name="wt_embed_output" id="wt_embed_output" class="wt_embed_output"/>
Code 1:
function myFunction() {
var x = document.getElementById("wt_embed_output").value;
alert("The input value has changed. The new value is: " + x);
}
document.getElementById("wt_embed_output").addEventListener("change", myFunction);
Code 2:
$( "#wt_embed_output" ).change(function() {
alert( "Value has been changed" );
});
For now, it doesn't work when the value is updated with the script, it only works when the user manually changes the value. Does anyone know a way to do it?