Uncaught Syntax Error: Unexpected token if


#1

I'm still having a problem as well. Maybe you guys can help me.
Here's my code so far.

I keep getting the message
Oops, try again. It looks like the o key isn't opening a description. Remember to toggle the current article's description inside the event handler. Look back at the instructions for the code

and an Uncaught Syntax Error: Unexpected token if

var main = function() {
$('.article').click(function () {
$('.article').removeClass('current');
$('.description').hide();

$(this).addClass('current');
$(this).children('.description').show();

});

$(document).keypress(function(event) {
$ if(event.which === 111){
$('current').children('description').toggle()};
});
};
$(document).ready(main);


"O" kerpress shortcut isn't working
#2

Hi @laura2617,

You need to remove the dollar sign ($) in front of your if statement.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.