Skip to content

Instantly share code, notes, and snippets.

@mattfawcett
Created September 21, 2011 14:10
Show Gist options
  • Save mattfawcett/1232125 to your computer and use it in GitHub Desktop.
Save mattfawcett/1232125 to your computer and use it in GitHub Desktop.
<html>
<head>
<style>
.current {color: green;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#things li').click(function(){
$('.current').removeClass('current');
$(this).addClass('current');
});
});
//window.removeEventListener("unload");
</script>
</head>
<body>
<ul id="things">
<li>Thing 1</li>
<li>Thing 2</li>
<li>Thing 3</li>
<li onclick="document.getElementById('things').style.color = 'red';">Thing 4</li>
</ul>
<a href="http://google.com">Go away</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment