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 Using text() and html()

why is this challenge not letting me continue

So according to jQuery documents either of these should provide the correct results $('.profile-text').html("<p> I am a web developer.</p>"); or $('.profile-text').text( "I am a web developer"); yet the challenge does not let me move forward and it seems via preview that the code is executing properly. Any ideas

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

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
$(".profile-text").html();

2 Answers

yk7
seal-mask
.a{fill-rule:evenodd;}techdegree
yk7
Full Stack JavaScript Techdegree Student 22,891 Points

$(".profile-text").html();

I just redid the challenge, and copy paste the code from your post and your code is correct for task 1 of 3.

Neil McPartlin
Neil McPartlin
14,662 Points

Hi Trace. I can confirm Youssef's findings about Challenge 1 but I believe you are talking about Challenge 2.

Whilst both your suggestions are valid code, only this one will pass the challenge $('.profile-text').text( "I am a web developer");. The other would attempt to add additional p tags to those already present in the html.

One issue I do see though is with these instructions...

"Important: In each task of this code challenge, the code you write should be added to the code from the previous task".

However, in this case, you cannot meet this demand because your answer to Challenge 1 being .html() as opposed to .text() must be either changed or completely replaced, otherwise you will not pass Challenge 2. So I replaced your Challenge 1 answer with your .text() answer for Challenge 2 and it passed.