0

I am having trouble with my code. Specifically it is my jQuery click function. This may seem trivial, but I could not get it to respond whenever I tried to click a link. I tried to debug it, I updated to the latest jQuery. Then I put it into a Jsfiddle bin with the latest jQuery .... no dice. I honestly don't have a clue what I did wrong. I get a highlighted error on my ("nav a") jQuery selector but I have double checked with the internet and that is the proper syntax and it still won't run. Below is my code. I cannot paste full HTML in here as it would become links as well.

$(document.ready(function(){
  $("nav a").on("click",function(){
       alert("What's WRONGG!");
   });

});  

I am using jQuery 2.1.4 on local and 2.1.3 on jsfiddle if that makes a difference. Here is the fiddle.

1
  • One problem is a missing end paren on $(document Commented Jul 24, 2015 at 18:06

2 Answers 2

3

I believe you are missing a parenthesis on your $(document)

$(document).ready(function(){
  $("nav a").on("click",function(){
       alert("What's WRONGG!");
   });

}); 
Sign up to request clarification or add additional context in comments.

Comments

0

You have missed ) bracket near $(document

$(document).ready(function(){
  $("nav a").on("click",function(){
       alert("What's WRONGG!");
   });

});

Comments

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.