thirudotnet
01-21-2006, 08:01 AM
Onchange event of textbox is not firing in IE under this condition but fires in Opera.
Condition:
After changing the value, in the tab key press again i'm changing the value dynamically at this time the onchange event is not firing. But it works fine in Opera. Have a look at the code.
--------------------------------------------------------------------------
<html>
<head>
</head>
<body>
<form>
<input type="text" name="1" id="1" onkeydown="one_onkd();" onchange="txt_onchange();"><input type="text" name="2" id="2" onchange="txt_onchange();">
</form>
</body>
<script>
function one_onkd()
{
if (event.keyCode==9)
{
document.getElementById("1").value="newvalue";
}
}
function txt_onchange()
{
alert("On Change event of " + event.srcElement.id);
}
</script>
</html>
--------------------------------------------------------------------------
Condition:
After changing the value, in the tab key press again i'm changing the value dynamically at this time the onchange event is not firing. But it works fine in Opera. Have a look at the code.
--------------------------------------------------------------------------
<html>
<head>
</head>
<body>
<form>
<input type="text" name="1" id="1" onkeydown="one_onkd();" onchange="txt_onchange();"><input type="text" name="2" id="2" onchange="txt_onchange();">
</form>
</body>
<script>
function one_onkd()
{
if (event.keyCode==9)
{
document.getElementById("1").value="newvalue";
}
}
function txt_onchange()
{
alert("On Change event of " + event.srcElement.id);
}
</script>
</html>
--------------------------------------------------------------------------