jquery not working while implemented in html header of WordPress

I’m trying to use jquery in my pages on a wordpress install, and nothing seems to work.
it is called via php line (if i got it right) :

wp_enqueue_script(‘jquery’);

Read More

I am assuming some jquery scripts are working (the ones coming together with the theme i’m using) but for some reason no single other script that i’d like to add will function.
I tried implementing it/them in the header of my index page, or in a js file, but none of these methods seem to work.
here is the link : http://selectedworx.com

thank you for any hint on how to get it working… it’s driving me nuts :/

Related posts

Leave a Reply

2 comments

  1. DEMO: http://jsfiddle.net/7uAUg/
    Your code seems to be working fine, the $ operator is likely being assigned to a different meaning. This is likely happening in one of the 40+ includes that happen in your page.

    Uncaught TypeError: Property '$' of object [object Object] is not a function 
    

    is the only exception you are experiencing so instead of

    <script type="text/javascript">
    $(document).ready(function(){                          
         $("div").css("border", "3px solid red");
    });
    </script>
    

    use

    <script type="text/javascript">
    $(document).ready(function(){                          
         jQuery("div").css("border", "3px solid red");
    });
    </script>
    

    as stated by @wirey

  2. Try to add <?php wp_head();?> inside your header and inside your footer <?php wp_footer();?> Also add no-conflict mode for your Jquery:

    jQuery(document).ready(function($){
    
        alert('This is a alert!!');
        //So now you can call your functions with $ !
                $('.someclass').hide();//for example    
        });