Where are you putting the js in the html page? If you look at this fiddle it doesn't work because I have selected to have the js in the head which is attaching the event to an element that doesn't exist yet.
Put the js in the body and wrap it just like John S said
<body>
<script type="text/javascript">
$(function() {
// js code here
});
</script>
</body>
Also, make sure you are including the jquery library!