Have you added jQuery to your site?
Trying the same code on tinker.io throws an error, but then adds jQuery lib, and the error disappears.
CDN: http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
add it using this snippet
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
source share