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

You've just learned how to use the jQuery methods text() and html(). Use the appropriate jQuery method to select the h1

No even sure on what to do here

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
jQuery(".profile-header").text("Student <span>Profile</span>");
jQuery(".profile-text").text("I am a web developer");

2 Answers

David Evans
David Evans
10,490 Points

Hi again Bala,

Like your other question here: https://teamtreehouse.com/community/youve-just-learned-how-to-use-the-jquery-methods-text-and-html-use-the-appropriate-jquery-method-to-set-the-conten

They now want you to select the <h1> tag and use the other method that you chose not to use in the 2nd part of the challenge.

To change the markup inside of the selected element you would use .html(). To change just the text you would use .text().

george NGOWI
PLUS
george NGOWI
Courses Plus Student 7,499 Points

This works for me

$(".profile-text").text("I am a web developer"); $(".profile-header").html("Sudent <span>Profile</span>");

It is correct, but dont forget to check all frases. The work "Student" was misspelled.

So, the correct code is: $(".profile-text").text("I am a web developer"); $(".profile-header").html("Student <span>Profile</span>");

have a good luck.