Forums

  • # June 20, 2008 at 9:58 pm

    Hi all,
    I’ve been building a site with wordpress and came across a bit of a problem trying to insert a jquery script to the header.
    Apparently it doesn’t like the $ and won’t recognise any function with the $ before it! I was adding this between some script tags.

    Code:
    $(document).ready(function(){
    < ------ stuff here -----/>
    });

    No luck! After a lot of head scratching i found an article that recommended this instead.

    Code:
    jQuery(document).ready(function($) {
    < ------ stuff here -----/>
    });

    Works like a charm. You can now use the $ inside the document.ready function. It’s to do with other javascript librarys used in WordPress so they don’t conflict. I’d never heard of this so i hope it’s useful to someone else!

    Tob :D

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag