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 trialKathryn Notson
25,941 PointsjQuery 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.
<!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>
$(".profile-text").text("I am a web developer.");
2 Answers
Steven Parker
231,269 PointsThe challenges can be very picky about message contents!
The instructions say to set the contents of the ... element to "I am a web developer" Note: there is no period in the message.
Kathryn Notson
25,941 PointsSteven 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.
Carlos Morales
3,460 PointsCarlos Morales
3,460 PointsHi 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
231,269 PointsSteven Parker
231,269 PointsYour code looks good. 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.