Interactive Website: The O shortcut


#1

I cannot see the issue with my work. Can someone please help?


#2

Hi Bloodytyrant,

Try adding a dot (.) in front of article on line 6. If that doesn't pass you, please copy/paste your code into the forums, since screenshots are hard to work with.
Thanks!


#3

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

This is my code. Thank you for the speedy response.


#4

Hello,

I am having the same issue. Here is my code:
var main =function() {
$('article').click()
$(this).children('.current').addClass();
$(this).children('.description').show();
$(this).children('.current').removeClass();
$(this).children('.description').hide();
});
$(document).keypress(function(event) {
if(event.which===111) {
$('.current').children('.description').toggle();
});
});
};

$(document).ready(main);

It says the code for o isn't opening the description.


#5

after your remove class should be " ; "


#6

Thank you, @heavenburnt! That helped entirely. My thing works now!


#7

I am having the same issue. Here is my code:
var main =function() {
$('article').click()
$(this).children('.current').addClass();
$(this).children('.description').show();
$(this).children('.current').removeClass();
$(this).children('.description').hide();
});
$(document).keypress(function(event) {
if(event.which===111) {
$('.current').children('.description').toggle();
}); <-- take away the closed parenthesis and semi colon
}); <-- take away semi colon
};

$(document).ready(main);\

This should work after you do that!


#8

I can't see what's wrong with mine either.

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


#9

I can't see what is wrong with my code too?
this is my code:
var main = function(){
$('article').click(function(){
$('.description').hide()
$(this).children('.description').show();
$(this).current(.addClass();
$('.article').current(.removeClass();
});
$(document).keypress(function(event) {
if(event.which === 111) {
$('.current').children('.description').toggle();
}
})
};
$(document).ready(main);


#10

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

I can't tell what I am missing but when I try to submit it, it tells me that the "o" key isn't opening a description.


#11

It's always says "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."
if you can find any error on my code please tell me ..
var main=function(){
$('.article').click(function(event){
$(document).keypress(function(event){
if(event.which===111){
$('.current').children('.description').toggle();
}
});
$('.article').removeClass('.current');
$('.description').hide();
$(this).addClass('.current');
$(this).children('.description').show();})};

$(document).ready(main);