user990016
user990016

Reputation: 3368

javascript - Uncaught SyntaxError: Unexpected token {

Just one of those times when I just can't see the problem. It appears to be the opening brace at the end of the if statement.

  $('#title_number').change(function () {
    if ($('#title_number').val() == 73) or ($('#title_number').val() == 74) {
    $('#ProfessorDiv').show();
    }
  });

Upvotes: 1

Views: 69

Answers (1)

Jason McCreary
Jason McCreary

Reputation: 72961

Your if statement is malformed (parenthesis grouped or, not the entire expression):

if ($('#title_number').val() == 73 || $('#title_number').val() == 74) {
  $('#ProfessorDiv').show();
}

Also there is no such logical operator as or. You meant ||.

Upvotes: 4

Related Questions