0

I feel really silly asking this, but it is completely blowing my mind why my link to the Google jQuery api isn't working. I know my code isn't broken because it works here: http://jsfiddle.net/jefffabiny/8p46d/

Here are my script tags in my index file:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/functions.js"></script>

Other than that, the doctype is HTML5, and I'm working on an local xampp install. I bet I over looked something small; does anyone see the problem here? Thanks.

EDIT Actually, after I submitted this post I got an alert at the top of my browser saying stack overflow requires javascript from an external domain to run properly, but it was being blocked. I guess that's my problem, but does anyone know how to fix that?

17
  • Looks like jQuery works fine to me Commented Jun 22, 2012 at 13:28
  • 1
    What do you mean "not working"? Commented Jun 22, 2012 at 13:28
  • Do you see a JS error? If so, what's the error? Also, did you make sure to clear the cache? Commented Jun 22, 2012 at 13:29
  • look at your code in firefox sourcecode - are there red parts? If so you've probably missed a quote or something like this Commented Jun 22, 2012 at 13:30
  • 1
    That edit is a real head-scratcher. Commented Jun 22, 2012 at 13:31

1 Answer 1

5

Are you executing your code after DOM is ready? jsFiddle does!

Try this:

$(function() {
    $('.test').on("click", function(){
        $(this).css('color', 'blue');
    });​
});
Sign up to request clarification or add additional context in comments.

2 Comments

When nothing seems wrong, it's almost always document.ready.
I knew it would be something dumb... thank you. I'd still like to know if anyone has any input on that 'failed to load from another domain' alert.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.