wordpress + jquery syntax error

I got this code here…

<script type="text/javascript">
    $('document').ready(function() {
        alert($('.thickbox'));
    });
</script>

and I put this code in my wordpress theme footer.php file at the bottom. When I went to my page, the alert did not appear, I check my error console and found this error

Read More
TypeError: $ is not a function  

$('document').ready(function() {

what gives? my jquery file is in the header, so this should work…or is there a specfic way to put jquery in wordpress?

Related posts

Leave a Reply

3 comments

  1. WordPress’s packaged jQuery defaults to noConflict mode, use jQuery('document'), or wrap your code like

    (function($) { 
        // Code that uses jQuery's $ can follow here.
    })(jQuery);
    

    or in your document ready like this:

    jQuery(document).ready(function($) {
        // Code that uses jQuery's $ can follow here.
    });