O shortcut, Making an Interactive Website


Help please! I swear my code looks all correct to me. It toggles the article only HALF half the time. The instructions and my code are below.


The o shortcut
Keyboard keys are identified by key codes. The o key is identified by the key code 111.

We can use event.which contains which key was pressed. If event.which === 111, then we know the o key has been pressed.

If the o key is pressed, we should toggle the current article's description.

Inside the keypress event handler, write an if statement:

The if statement should check whether event.which === 111.
If it does, then toggle the current article's description using:

It is important you click on the first article before pressing the o key!

The o key currently works for the first article's description. Let's add add another keyboard shortcut to move on to the next article.

My Code

var main = function() {
$('.article').click(function () {

    $(document).keypress(function(event) {
        if(event.which === 111) {




You will have to close your article =click= Eventhandler with it's closing });
before you start your document =keypress= Eventhandler......


Have the same problem :frowning: can you just 'copy-paste' corrected code. It will be better to understand . Thanks!


I can't copy it and paste it right now because I'm away and on my phone but basically I had to close my click function for the articles before I started the key press. The key press function has to be in main but outside of the click function. Hope this makes sense


I need help also! I have used hints and wrote the exact code out and nothing seems to be working expect telling me
"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 would present the code you are using,
maybe we could help....