why my jquery codes doesn't run?

javascript, jquery

Solution

You're missing the final `});` for the statement

<title>Example</title>
  <script type="text/javascript" src="jquery-1.3.2.js"></script>
  <script type="text/javascript">
    $(function() {
      $("#link").click(function() {
        $("#pg").toggle();
      });
    )}; //<-- Missing close bracket
  </script>

Also, if you're using Firefox, check out Firebug. Its an invaluable debugger tool and will show you where errors are happening.

Chrome has a Developer Tools enabled, not sure about IE.

Problem

I want to toggle element that id's pg when click link. header: ``` <title>Example</title> <script type="text/javascript" src="jquery-1.3.2.js"></script> <script type="text/javascript"> $(function() { $("#link").click(function() { $("#pg").toggle(); }); </script> ``` Elements: ``` <p id="pg">deneme deneme 123 deneme</p> <a href="#" id="link">toggle</a> ```

Original source