javascriptjquerysyntax

jQuery syntax error with unexpected token


Sorry for basic... I expect some pro's will mark me down - again, however I have been struggling to see the error of my ways:

Unexpected token { is my error, and the code is:

  <script>
$(document).ready(function {
  $('people.img').click(function() {
    $('.peopleSummary').addClass('hello');
  })
});

Thanks!


Solution

  • $(document).ready(function() {//<-- missig () after function
        $('people.img').click(function () {
            $('.peopleSummary').addClass('hello');
        })
    });