Support » Themes and Templates » jQuery not working in WordPress

  • Resolved adastra

    (@adastra)


    I can’t seem to get jQuery to work in my WordPress theme. It’s really the simplests of scripts, yet I get no reaction at all from jQuery. I’ve already looked through the forums and google and remain clueless. Not even the alert (for testing) is working.

    I’ve included in in my theme header from an external js file, and this is the code:

    jQuery(document).ready(function($) {
    	 $("#container").alert("blah");
    });
    jQuery(document).ready(function($) {
    	 jQuery(".goodshelf_ul li:first").css("border-top: none;");
    	 $(".custom_ul li:first").addClass("first");
    });
    jQuery(document).ready(function($) {
    	 $("#footer .frame:last").css("margin: 0;");
    	 $("#footer .frame:last").addClass("last");
    });
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter adastra

    (@adastra)

    I’m 100% sure that jQuery is correctly included because I have plugins that use jQuery. But when I try to include my own jQuery stuff, nothing seems to be working.

    Hi,

    Have you tried setting the jquery file in your header (assuming you have the jquery file in your templates folder, but it can be anywhere, as long as you reference it correctly):

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.3.2.min.js"></script>

    Also, try changing:

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

    to

    $(document).ready(function(){
    	 $("#container").alert("blah");
    	 $(".goodshelf_ul li:first").css("border-top: none;");
    	 $(".custom_ul li:first").addClass("first");
    	 $("#footer .frame:last").css("margin: 0;");
    	 $("#footer .frame:last").addClass("last");
    });

    I use jquery on all my wordpress sites and it work fine…

    hope this helps.

    Q

    Thread Starter adastra

    (@adastra)

    Thank you, I figured it out now have a lot of testing!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘jQuery not working in WordPress’ is closed to new replies.