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 trialSimtion Rares
800 PointsSelc the heading text with class of .profile-name,Use jQ text() method to set content of .profile-name to input of input
Am I doing it right?
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<h2 class="profile-name">Treasure Porth</h2>
<p class="profile-text">I am a web developer!</p>
<label>Change name:<input id="name-input" type="text"></label>
<button>Change</button>
<script
src="jquery-3.2.1.min.js"></script>
<script src="app.js"></script>
</body>
</html>
$('button').click(function() {
const newName = $("#name-input").val();
const prof = $('.profile-name').val();
$('#name-input').text(prof);
});
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You did terrific on the first step, but I feel like there might be a misunderstanding on the second step. The challenge never asks you to create a second variable. Instead it wants you to select the element with the class "profile-name" and change the text to match what is now stored in your newName
variable.
Take a look:
$('.profile-name').text(newName);
This selects the element with the class "profile-name" and then changes the text to the string now stored in newName
.
On a side note, I see that you've asked this same question several times fairly short succession. Remember that you are posting to your fellow students. Many of us love to help out when/if we can. That being said, we live all over the world and in different time zones. A little patience goes a long way
Simtion Rares
800 PointsSimtion Rares
800 PointsThx for the help! I am sorry for posting the question so many times I forgot to put the question in the description so that's why I did it again. My bad