Halp pls? 7/10 The o Shortcut


#1



I cannot get this code to cooperate with me. I keep getting the error:
"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."

I have even gone so far to copy and paste the help blurb into my code with no luck. Can any of you geniuses help me out? My code is below.


var main = function() {
    $('.aricle).click(function()
        $('.description').hide();
        $(this).children('.description').show();
        $(this).addclass('current');
        $(this).children('.description').show();
        $(document).keypress(function(event) {
            if(event.which === 111) {
                $('.current').children('.description').toggle();
            }
        });
    <div class="aricle">
    <div class="item">
        </div>
        <div class="description">
        </div>
    </div>
};
$(document).ready(main)


#2

HI this line you didn't close the string

$('.aricle).click(function()

it's missing the '


#3

on the second line you should have a curly bracket at the end of the line.

$('.article').click(function() {

Also on the same line you have a left parenthesis before function which is never closed. You might need to change addclass to addClass. I don't know whether that will cause it to fail. You don't need any HTML in the app.js page e.g. div tags etc.


#4

Added the ' and nothing changed, I'm still getting the same error.


#5

I added a { and closed it along with the open ( I'm still getting the same error as before


#6

you code should have that structture

var main = function(){
   $('.aricle').click(function() {
        ....
   }); 
   $(document).keypress(function(event) {
        ....
    });
};
$(document).ready(main)

then remove this part of code

    <div class="aricle">
    <div class="item">
        </div>
        <div class="description">
        </div>
    </div>

#7

I took out the variables and it gave me an error saying I had to make sure my variables were defined. I restructured my code and started from scratch. Still no progress.


#8

can you post your new code?


#9

var main = function() {
   $('.aricle').click(function() {
       $('.description').hidden();
       $(this).children('.description').show();
       $(this).addclass('.current');
       $(this).cildren('.description').show();
   }); 
   $(document).keypress(function(event) {
        if(even.which === 111) {
            $('.current').children('.description').toggle();
        };
   });
};
$(document).ready(main)

#10

try changing addclass to addClass. You have written 'cildren' instead of 'children'. Other than that it looks good :slight_smile:


#11

Made both of those changes and I'm still getting the error saying the o key won't open it :tired_face:


#12

change 'even' to 'event', then you are done!


#13

Fixed that along with my article spelling error. It still doesn't work. Could this be a bug on Codecademys side?


#14

Please post your code up. I don't think it is an error on the site, I worked through it yesterday.


#15

Change 'aricle' to 'article'. Then you're done!!


#16

you might consider to re-do the lesson from the begin because like the error is saying it's missing some variable.


#17

Heres the code with the variables, still getting an error. :confounded:

var main = function() {
   $('.article').click(function() {
       $('.description').hidden();
       $(this).children('.description').show();
       $(this).addClass('.current');
       $(this).children('.description').show();
   }); 
   $(document).keypress(function(event) {
        if(event.which === 111) {
            $('.current').children('.description').toggle();
        };
   });
   
   <div class="article">
    
        <div class="item">
        </div>
        
        <div class="description">
        </div>
    </div>
   
};
$(document).ready(main)

#18

Take out the HTML. Each line starting with div is HTML and you can remove it.


#19

And we have lift off. Thanks a ton for the help man, really appreciate it. Sorry there we're so many small stupid things like spelling errors.


#20

I know exactly what you're going through :wink: