Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics Introducing jQuery jQuery Syntax and Animation Effects

I can not understand why my answer is wrong

I can not understand why my answer is wrong

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<body>
    <h1 class="profile-header">Student <span>Profile</span></h1>

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
//
$('.profile-header').delay(2000);
$('.profile-header').hide();

$('.profile-header').fadein();

3 Answers

Matthew Long
Matthew Long
28,407 Points

You're are almost using the correct three jQuery methods. However, there are a couple issues. First, you're not using them in the correct order. The challenge wants the element hidden, and then after 2 seconds wants the element to "fadeIn". Note that it is fadeIn() with a capital "I". The second issue is that you're not chaining the methods:

$('.profile-header').hide().delay(2000).fadein();

Hi Hadar, your Javascript code is fine. You just didn't do exactly what the challenge requested. Instead of writing each line of code like you did, you're meant to chain them to each other(this is possible in jQuery) in a single line like this:

$('.profile-header').hide().delay(2000).fadeIn();

This is a method in jQuery called 'chaining'. Applying various methods to a single or group of selected elements. And you didn't spell the 'fadeIn()' method correctly, you used small letter 'i' instead of capital letter 'I'(camel casing).

Jesus Mendoza
Jesus Mendoza
23,289 Points

Hey Hadar,

In jQuery you can chain multiple methods, so the answer should be:

$('.profile-header').hide().delay(2000).fadeIn();
Matthew Long
Matthew Long
28,407 Points

Don't forget to mention all the issues wrong with someones code in order to provide them with the most help possible! Happy holidays!