Interactive Website Newsreader 'The O Shortcut


#1

Hi :slight_smile:

I've been having some trouble in getting the O shortcut to work in the Interactive Website section of the course.

Here's my code so far, any help would be much appreciated as it is doing my head in that I can't find it!

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);

Oh and I also have a SyntaxError: Unexpected Token Function.

Thanks! :smile:


#2

Have a look at this ^

.click(function(){

^should be something like this


#3

Unfortunately that is not the reason the code isn't working. It is still coming up with the same errors

Thanks for your help.


#4

Please paste in your updated code and error message


#5

Look closely at the $(.'current') part.

You can remove the . before current, since the computer knows it's a class ( because of addClass() , means that the input in the parenthesis can only be a class)

Hope this helps!!!


#6

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