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 trialSura Salman
7,204 PointsOn line 5 of app.js, use the classList property on the anchor to add a new class of "selected" to it.
What is the answer of it ?
10 Answers
Sreng Hong
15,083 PointsHi Sura
Here is the answer:
anchor.classList.add("selected");
chaz
25,372 Points.add()
this isn't covered at any point during the lesson. The lack of continuity between the lesson project and code challenge projects is Treehouse's greatest weakness.
Sura Salman
7,204 PointsThnk you mate. It works fine for me. I just wanted to save myself from javascript. I understood nothing from Andrew and Jim. I will continue on PHP and CSS.
Sreng Hong
15,083 PointsYour welcome
lukebiggerstaff
27,534 PointsSura,
Make sure that you're trying to figure these out on your own, google everything that you're having trouble with and you will learn much faster.
That being said, anchor.classList.toggle('live'); will get the job done.
Luke
Harry Beckwith
13,452 PointsFor jQuery and basic javascript projects i would recommend https://www.udemy.com/projects-in-javascript-jquery/ really valuable lessons learnt!
Sura Salman
7,204 PointsTHNk you. On about line 9 in app.js, use classList to toggle the "live" class on the anchor element. ?
Sreng Hong
15,083 PointsI think it's simply the same. All you have to do is read the instruction clearly.
They said use classList to toggle the live class on the anchor element, so you can use the same answer from task 1 of 2 to change the keyword add to toggle and the class selected to live.
Hope this helps.
Sura Salman
7,204 PointsI did it mod's can clear my posts.Thats all and im done.
Tony Brackins
28,766 PointsHey Sura,
These classes from Jim and Andrew were EXTREMELY difficult. With that said, don't give up! You will get a little piece from each class and can do learning in other places as well.
Here's a good course that I found in the forums that explains a little better: https://www.youtube.com/watch?v=LsY2PsPKckU&feature=youtu.be
Josephine Mukuya
5,911 Pointssure,, thanks guys, at least i know its not me alone,,i didnt get anything from Andrew,,his approach is something,, will try understand from other sources.
Rich Braymiller
7,119 PointsAndrew is awful!
Harry Beckwith
13,452 PointsThe lessons are very technical and specific to that certain problem. But to be honest i would not know how to apply it to another problem, just from these videos. Saying that i have learnt a few things. I am thinking of buying a text book to try and understand javascript applied on websites.... any one know of a good one?
David Hughes
5,063 PointsI have to agree with some comments from others. I have some understanding of JavaScript before starting this course. And though the course DOES introduce us to several new ways of performing tasks, they aren't really explained. I spent a lot of time reviewing my own code and entering really long comments to better explain what was not being explained in the videos.
In a way this was an effective way to learn. But there were many times that I was entirely lost. I think the course just needed some additional clarity. It is was really difficult to follow how
addButton.onclick = addTask;
triggered addTask
, which would then createNewTaskElement
, and pass in a variable that we defined globally at the start of the lesson.
As I said, I did learn from this, but I feel that I could have learned even more had each step been explained a bit more clearly.
With all of that being said(I think I'm the third person to use that phrase on this thread) TreeHouse courses have been amazing thus far.
Herman Morales
8,831 Pointsthis is the answer anchor.classList.toggle('live');
Jeff Busch
19,287 PointsJeff Busch
19,287 PointsLet's see the code you have tried.