Jump to content

Any workaround for onChange event not fired in IE8-?


Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script>window.onload = function(){ document.getElementById("txt").onkeypress = function(evt){  var evt = (evt) ? evt : ( (event) ? event : null ) ;  var elem = (evt.target) ? evt.target : ( (evt.srcElement) ? evt.srcElement : null ) ;  if((evt.keyCode == 13) && (elem.type == "text"))  {   document.getElementById("t").focus();   return false;  }}}function c(){alert(document.getElementById("txt").value);}</script></head><body><form name="form" id="form" onchange="c();"><input id="t" type="input" value="t"/><input id="txt" type="input" value=""/><input id="t2" type="input" value="t2"/></form></body></html>

The onChange event is only fired in IE9, not IE7 or IE8.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...