Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Created May 5, 2013 15:34
Show Gist options
  • Save bingeboy/5521142 to your computer and use it in GitHub Desktop.
Save bingeboy/5521142 to your computer and use it in GitHub Desktop.
Dom2 Event Example
<html>
<head>
<title>Basic Dom2 Event Handler And Bubble Test</title>
</head>
<body>
<div id="container">
<ul id="listContainer">
<li id="item1">item1</li>
<li id="item2">item2</li>
</ul>
</div>
<script type="text/javascript" charset="utf-8">
var el = document.getElementById('listContainer')
// DOM 2 event. This is basic example and will have issues with IE.
el.addEventListener('mouseover', function(){
alert('mouseover');
}, false);
el.addEventListener('click', function(){
alert('click!');
}, false);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment