Stuck on 7/16 Fade in


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

I’m sure im stuck on the easiest problem but i can’t seem to figure out why this code wont run.
Even the hint says that my .hide and .fadeIn actions are correct.
please help :slight_smile:

https://www.codecademy.com/courses/learn-javascript/lessons/javascript-dom/exercises/fade-in?action=lesson_resume&link_content_target=interstitial_lesson

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
/home/ccuser/node_modules/babel-core/lib/transformation/file/index.js:590
throw err;
^

SyntaxError: /home/ccuser/workspace/learn-javascript-U5L1/js/main.js: Unexpected token (3:9)
e[0m e[90m 1 | e[39m$(document)e[33m.e[39mready(main)e[33m;e[39m
e[90m 2 | e[39m
e[31me[1m>e[22me[39me[90m 3 | e[39me[36mfunctione[39m () { $(e[32m’.skillset’e[39m)e[33m.e[39mhide()e[33m;e[39m
e[90m | e[39m e[31me[1m^e[22me[39m
e[90m 4 | e[39m$(e[32m’.skillset’e[39m)e[33m.e[39mfadeIn(e[35m1000e[39m)e[33m;e[39m
e[90m 5 | e[39m}
e[90m 6 | e[39me[0m
at Parser.pp$5.raise (/home/ccuser/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/home/ccuser/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$1.parseFunction (/home/ccuser/node_modules/babylo


```

function () { $(’.skillset’).hide();
$(’.skillset’).fadeIn(1000);
}

<do not remove the three backticks above>

#2

This looks like a handler callback function when it should be an inline statement…

$('skillset').hide().fadeIn(1000);

#4

but there is supposed to be a space between function and its parentheses.
i tried it without the space and it still doesn’t pass.
without the space the error moves to 3:8


#5

this seems to give me the same problem aswell

function () { $(’.skillset’).hide(); }
$(’.skillset’).fadeIn(1000);


#6

Don’t write it inside a function body. It is a direct (inline) statement.


#7

ok.

even after using this:

$(’.skillset’).hide();
$(’.skillset’).fadeIn(1000);

it gives me this error message:
"Did you write a jQuery selector for the skillset element?"
but this IS the jQuery selector


#8

Just noticed my example is missing the dot, but you caught that. I don’t see anything wrong with your code. Since you are using the same selector for both statements you can chain them…

$(’.skillset’).hide().fadeIn(1000);

which just makes it easier to read and follow.

Can you post your complete code, please?


#10

$(’.skillset’).hide().fadeIn(1000);

error that follows:
Did you write a jQuery selector for the skillset element?


#11

Is that all the code you have?


#12

yes.
same error message with this answer aswell:

$(’.skillset’).hide();
$(’.skillset’).fadeIn(1000);


#13

The problem is your script is likely running before the DOM content has finished loading. You need a ready event wrapper.

$(document).ready(function () {
  $('.skillset').hide().fadeIn(1000);
});

Alternatively,

const main = function () {
  $('.skillset').hide().fadeIn(1000);
};

$(document).ready(main);

Make sure your code does not contain smart quotes. Use the standard single or double quotes.


#14

OOOH MY… THANK YOU!

this is why i had the function earlier on in the post (because of the previous lesson)
I started to delete everything once i kept getting error messages.
it seems that earlier on i missed “main” after the function.

once again thanks for your time


#15

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