Challenge #99 Jquery

I’m on lesson 99 “learn how script tags and document ready works” and this code is not working. What gives? Using Chrome browser…


<script>
  $(document).ready(function() {
    
  });
</script>

Thanks for any help you can provide! I hope this is not a really stupid question (apologies in advance if so).

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

Your code is fine. Maybe you can refresh the page, restart browser or use another browser, to see if that helps.

When you say “not working”, do you mean failing the tests or just not doing anything?

If you just mean it’s not doing anything, that’s fine - it’s not supposed to do anything yet. It just sets up a function that is called once the page is ready - you haven’t written any code to execute within the function yet. :wink:

You can see for yourself that it’s working by pasting some code to execute within it:

<script>
  $(document).ready(function() {
    alert('This message will show once the page is ready.');
  });
  
  $('fakeElement').click(function() {
    alert('You will never see this message!');
  });
</script>

You’ll see the first message as soon as the page is ready, but you’ll never see the second message because fakeElement doesn’t exist on the page so you can’t click it.

I mean when I run the challenge test, nothing happens and I can’t move on. Thanks for your help! I’m going to restart my browser and see if that works.

I had the same issue with that one and a couple other ones. The code was correct but wouldn’t move on. I found that refreshing the page and trying again fixed the issue