I have an onchange event on an input field. Is there anyway to trigger this if the field is updated by another piece of javascript? Here's an example of what I mean:
I realise I can call the ShowIt function at the end of ChangeIt but the above is just an example and this would not work for my actual app. i.e. The onchange event can be dynamic.
Thanks
Nick
Code:
<script language="javascript">
function ChangeIt(){
var obj = document.getElementById('MyInput');
obj.value='Hello!';
}
function ShowIt(){
var obj = document.getElementById('MyInput');
alert(obj.value);
}
</script>
<input type="input" id="MyInput" onchange="ShowIt();"><br />
<a href="#" onclick="ChangeIt();">Click here</a>
I realise I can call the ShowIt function at the end of ChangeIt but the above is just an example and this would not work for my actual app. i.e. The onchange event can be dynamic.
Thanks
Nick