I want to trigger an event hen the value of an input element using javascript.The value of the input element is changed using script ,and is not typed.I know that the onChange event fires not after the value is changed ,but after the value is changed and element looses focus(mouse is clicked outside the element.)..Here the input element does not loose focus.So onChange event willnot fire.So how to do that.. The following is the script ,once i tried and failed
<html>
<head>
<script type = 'text/javascript'>
function changed()
{
alert('changed');
}
function change()
{
document.getElementById('myId').value = 'Hello';
}
</script>
</head>
<body>
<input type = 'text' id = 'myId' onChange= 'javascript:changed();'/>
<input type ='button' value = 'change' onClick = 'javascript:change();'/>
</body>
I mean ,the function changed() should be called when the content inside textbox is changed using the function change().How to do that. Here is the jsfiddle for the code http://jsfiddle.net/BFz2a/