The o shortcut toggles half the events


#1

Im able to toggle half of the events but the other half have no reaction. What am I doing wrong?

var main = function() {
$('.article').click(function() {
$(document).keypress(function(event) {
if(event.which === 111) {
$('.current').children('.descrpition').toggle();}

});
$('.article').removeClass('current');
$('.description').hide();
$(this).addClass('current');
$(this).children('.description').show();
});

};


#2

@boardcoder85042,
You pasted-in your document =keypress= Eventhandler

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

into the middle of your article =click= Eventhandler

$('.article').click(function() {
     $('.article').removeClass('current');
     $('.description').hide();
     $(this).addClass('current');
     $(this).children('.description').show();
 });