jQuery works in tutorial, but not on my WordPress page
-
I put the following code in my header.php file just above the </head> element:
<?php wp_enqueue_script(“jquery”); // added this line to que jquery 8-14-2011
?>
<!– added this jquery script 9-14-2011 –>
<script type=”text/javascript”
src=”<?php bloginfo(“template_url”); ?>/js/principles.js”></script>The following jQuery code works fine with a test page, using firefox’s firebug console.
$(“p.foo”)
.slideUp(1000, function(){
console.log(“Hidden!”);
})
.slideDown(1000, function(){
console.log(“Shown!”);
});When I change the class name of the paragraph to “principles” and run it on my WordPress page with a paragraph with that class name, I get the following message:
$ is not a function
[Break On This Error] $(“p.principles”)
principles.js (line 1)Any ideas?
Also, should it work with a couple of images in the paragraph?Bruce
- The topic ‘jQuery works in tutorial, but not on my WordPress page’ is closed to new replies.