Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For some reason I can't get the jquery document ready to fire for my plugin

my javascript

jquery(document).ready(function($) {
    alert("hello world");
    $("#testdiv").text("hi");
});

the source from my website

<link rel='stylesheet' id='admin-bar-css'  href='http://example.com/wp-includes/css/admin-bar.css?ver=20111209' type='text/css' media='all' />
<script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var fantasy_golf = {"ajaxurl":"http:\/\/example.com\/wp-admin\/admin-ajax.php"};
/* ]]> */
</script>
<script type='text/javascript' src='http://example.com/wp-content/plugins/fantasy-golf/js/fantasy-golf.js?ver=1.2'></script>
<script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.js?ver=20090102'></script>

when I follow the source of my fantasy-golf.js (in firefox's source) it has the correct version of my js. (it shouldn't be due to it caching an older version)

share|improve this question

closed as off topic by Chip Bennett, Wyck, toscho Apr 25 '12 at 5:33

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Close-voted as off-topic. I'm not seeing how this is a WordPress question? You're using no-conflict mode (correctly), and your scripts are either hard-coded in your template, or else properly enqueued. That pretty much eliminates anything WordPress-specific. –  Chip Bennett Apr 24 '12 at 20:06
    
I'll move it to stack overflow then... I'm surprised since the plugin from this site does work. itsananderson.com/2011/04/wordcamp-seattle-meta which is pretty much what I'm trying to accomplish. –  Joe_Schmoe Apr 24 '12 at 20:09
    
Don't re-post anything. If needed, we can migrate content from one site to another. For now, I'll leave this here. –  EAMann Apr 24 '12 at 20:32

2 Answers 2

up vote 2 down vote accepted

Try using jQuery instead of jquery. (Note the capital "Q".)

Edit:

Upon viewing your source, you have an extra });.

Working example

share|improve this answer
    
I tried and tried again still no luck. –  Joe_Schmoe Apr 24 '12 at 19:51
    
Do you have a link where we can view a sample page? –  Joseph Apr 24 '12 at 19:54
    
Thanks so much!! –  Joe_Schmoe Apr 24 '12 at 20:14

You could try writing it a little differently. Instead of

jquery(document).ready(function($) {
    alert("hello world");
    $("#testdiv").text("hi");
});

Try this:

(function($) {
    $(document).ready(function(){
        alert('hello world');
        $('#testdiv').text('hi');
    });
})(jQuery);
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.