Stuck on the o Key...I have read others struggles and tried their code. Nothing works!


#1



The o Short cut

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.

.var main =function() {
    $('article').click(function()
    $('current').removeClass();
    $(this).children('description').hide();
$('current').addClass();
$(this).children('.description').show();
});
$(document).keypress(function(event) {
    if(event.which === 111) 
    $('.current').children('description').toggle();
    }
});

$(document).ready(main);

#2

your code isn't correct in many places. you have missing spaces and brackets everywhere
just recheck it all completely


#3

Hi, I'd been struggling with this myself but have just managed to pass this section with the code below. Hope this allows you to work back through 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);


#4
var main=function() {
     $('.article').click(function() { 
     }); 

     $(document).keypress(function(event) {
     });
   };
  $(document).ready(main);

In our main function we are defining 2 Event-handler
1 a click Event-handler attached to all articles
2 a keypress Event-handler attached to the whole document


#5

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