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()

jQuery Basics > Introducing jQuery > Using text() and html()

This isn't functioning the way it's supposed to do on Challenge Task 2 of 3. The code appears correct.

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").text("I am a web developer.");

2 Answers

Steven Parker
Steven Parker
229,732 Points

The challenges can be very picky about message contents!

The instructions say to set the contents of the ... element to "I am a web developer" :point_left: Note: there is no period in the message.

Carlos Morales
Carlos Morales
3,460 Points

Hi Steven i'm having trouble with the task 3 that follows this one i'm using this code and it keeps giving me and error like if it's wrong $(".profile-header").html("Student <span>Profile</span>");

Oh i didn't leave the previous code i just erased it. That worked i need to read more. Thanks Steven

Steven Parker
Steven Parker
229,732 Points

Your code looks good. :+1: Did you possibly overlook the instruction that said "Important: In each task of this code challenge, the code you write should be added to the code from the previous task."

If you replaced the task 2 code instead of adding this to it, that may be the issue.

Also, for future issues, always start a new question instead of adding one as an "answer" to an old one. Otherwise, your question might only be seen be the few people who asked/answered the old question.

Steven Parker:

Yes, I just figured it out on my own just before you emailed your response. More careful reading needed on my part. Instructors are VERY PARTICULAR & EXACTING with their answers to challenges.