The O Shortcut


#1

As far as I can tell my code is correct but I keep receiving an error message.
Can't spot the error!
Also, none of the exercises are displaying properly when I open the full screen option. Tested in both Chrome and IE.
Any help appreciated!

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


#2

Hi Daniel,

  • Line 2, you need a set of parenthesis (()) right before the opening curly brace ({), like this: (function() {
  • Lines 3 and 5, there shouldn't be a dot (.) before the class name: ('current')

Good luck with the rest of the course, and please let me know if you have any questions about anything :)


#3

Ahhhh, now I see. Perfect. Works in the browser now too. Very helpful, thank you!

Does this mean that my code passed lesson 6 with errors in it?
When I step back to lesson 6 the parentheses and dots are still there, but the lesson is marked correct.


#4

Apparently, yes :confused: