Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created July 13, 2011 15:30
Show Gist options
  • Select an option

  • Save jeremyckahn/1080531 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyckahn/1080531 to your computer and use it in GitHub Desktop.
A good interview question
<html>
<head></head>
<body>
<button id="mybutton">hello</button>
<div id="output"></div>
<script type="text/javascript" charset="utf-8">
(function () {
var button, output;
function handler (ev) {
output.innerHTML = 'Hello World!'
output.style.color = '#0f0'
}
button = document.getElementById('mybutton');
output = document.getElementById('output');
button.addEventListener('click', handler, false);
} ());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment