0

I'm beginner in jquery.this is my first application.

<head>
  <title>Untitled Document</title>
  <script type="text/javascript" src="../jquery-1.6.2.min.js"></script>
  <script type=”text/javascript”>
    $(document).ready(function(){
      $("a").click(function(){
        alert("Hello World");
      });
    });
  </script>
</head>
<body>
  <a href=”#”>Click me!</a>
</body>
</html>

but when i click on Click me the alert doesn't showed.what is problem? (the lib address(src="../jquery-1.6.2.min.js) is correct )

3
  • Have you checked firebug to make totally sure that your jquery lib is loading? Commented Jul 14, 2011 at 18:09
  • Your JQuery code isn't probably being loaded. Commented Jul 14, 2011 at 18:09
  • It works for me..with you code..The only change i did is that <script type="text/javascript" src="code.jquery.com/jquery-1.6.2.min.js"> Commented Jul 14, 2011 at 18:12

3 Answers 3

5

You have odd quotes in some of your code:

vs. "

That could be causing your problem. Change them all over to regular double quotes "

EDIT: Tested it, it's the funny quotes around text/javascript specifically but the other should be fixed too.

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

Comments

2

That works fine! check the jsfiddle http://jsfiddle.net/PdpWR/

Comments

1

I would guess you either have a problem with your reference to jQuery or with the weird quotes around your # and text/javascript.

I took your code and placed it in jsfiddle and it runs fine:

http://jsfiddle.net/PZxjV/

Are you sure that you have the correct location for your jQuery file?

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.