The problem with your code is, as we found out in the comments on the question, that you’re using $
, which is either undefined or has a conflict (in any case, it’s not pointing to jQuery
).
Using jQuery( document )
instead of $( document )
should do the trick!