-1

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!

1
  • This question appears to be off-topic because it is about syntax error Commented Dec 13, 2013 at 16:58

3 Answers 3

3
$(document).ready(function() {//<-- missig () after function
    $('people.img').click(function () {
        $('.peopleSummary').addClass('hello');
    })
});
Sign up to request clarification or add additional context in comments.

Comments

2

There is no html element called people, this is a incorrect selector

 $('people.img')

Also to define a function you need (), otherwise you get also a syntax error

$(document).ready(function {

So try this, assuming your people is a class (otherwise use # for a ID):

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

Comments

1

If people is a class then try

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

If it is an id try,

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

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.