Skip to content

Instantly share code, notes, and snippets.

@DanTup
Created July 9, 2013 15:24
Show Gist options
  • Save DanTup/5958265 to your computer and use it in GitHub Desktop.
Save DanTup/5958265 to your computer and use it in GitHub Desktop.
Strange IE10 issue. In IE7/8/9 this code will throw an error (attributes["onchange"] returns null). But in IE10, magic happens, and attributes["onchange"] returns attributes["name"] and the code alerts the name of the element!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
</head>
<frameset rows="70,*">
<frame src="about:blank">
<frameset cols="165,*">
<frame src="about:blank">
<frame src="settings.htm">
</frameset>
</frameset>
</html>
<!DOCTYPE>
<html>
<body>
<select name="danny_name" id="danny_id">
<option selected="selected" value="option1">Option 1</option>
</select>
<script type="text/javascript">
alert(document.getElementById('danny_id').attributes["onchange"].nodeValue);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment