Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Created May 19, 2013 06:24
Show Gist options
  • Save bingeboy/5606878 to your computer and use it in GitHub Desktop.
Save bingeboy/5606878 to your computer and use it in GitHub Desktop.
DOM2 Events
<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