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 trialMUZ140946 Simon Taanisa
6,212 Pointsm lost here
how do i fill in that
7 Answers
Christian Vann
9,021 PointsThe Question: Finish the code below to retrieve the text inside an HTML element with the ID of "button" and store it in the variable "animal":
Answer: .text()
John Grillo
30,241 Pointswhy just '.text()' and not 'this.text()'?
Alexander Olson
13,067 PointsThis should work - - var animal = $('#button').text();
Iain Simmons
Treehouse Moderator 32,305 PointsIf you mean the question: Finish the code below to retrieve the text inside an HTML element with the ID of "button" and store it in the variable "animal"
... then it's asking you to use a jQuery method to get the text content of an element. The selector for the element with the ID of button
has already been completed for you. Try searching through the jQuery documentation to find the method you need: https://api.jquery.com/
So you just need the method name followed by a set of parentheses:
methodName()
John Shields
7,477 PointsNone of these answers seem to work. I'm completely stuck on the same thing.
Sean Killeen
10,330 Points.text() worked for me
Emmanuel Choga
9,171 Pointstext() is the right answer
Sandeep Krishnan
9,730 Pointstry this - var animal = $('#button').text('animal');
Grace Kelly
33,990 PointsGrace Kelly
33,990 PointsWhat question are you stuck on??