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 trial2 Answers
Steven Parker
231,269 PointsSure, that will select the first li
element on the page. But by itself, it won't do anything — were you thinking of using it as part of an assignment or other statement?
Vic Mercier
3,276 PointsVic Mercier
3,276 PointsWhat do you mean by were you thinking of using it as part of an assignment or other staement?
Vic Mercier
3,276 PointsVic Mercier
3,276 PointsI've tried :jQuery("li")[0].text("JavaScript");//It doesn't work
Steven Parker
231,269 PointsSteven Parker
231,269 PointsThat won't work, because
$("li")[0]
is a plain HTML element but you're trying to use the jQuery.text
method on it which is only for jQuery objects. But this woud work:$("li")[0].textContent = "JavaScript";