Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other jQuery in WordPress!

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #22809
    Toby Pitman
    Participant

    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)
  • The forum ‘Other’ is closed to new topics and replies.