Created
October 25, 2011 22:11
-
-
Save seamusjr/1314515 to your computer and use it in GitHub Desktop.
native js event handler example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>untitled</title> | |
<!-- Date: 2011-10-25 --> | |
</head> | |
<body> | |
<button id="load-application">Load Application</button> | |
<script type="text/javascript"> | |
var element = document.getElementById("load-application"); | |
var loadApplication = function() { | |
console.log("Application loaded..."); | |
}; | |
var loadApplicationHandler = function() { | |
element.addEventListener("click", function() { | |
loadApplication(); | |
}, false); | |
}; | |
document.addEventListener("DOMContentLoaded", loadApplicationHandler, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment