1
votes

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');

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 :/

2
$ is undefined.. try using jQuery instead of $ place or reassign it back to jQuery $=jQuery since it doesn't look anything else is using it because it's undefinedwirey00
The example page used is loading jquery just fine, do what @wirey saidabc123
Try, just as wirey said, $ to jQuery.The Alpha

2 Answers

0
votes

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

0
votes

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    
    });