Jump to content
tinfanide

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.

Share this post


Link to post
Share on other sites

onchange should be put on <input>, <select> or <textarea> elements, not on the <form> element.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...