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 trialAndy Goodman
14,207 PointsMy code for the additional challenge Guil gave...
See link below for the code I wrote to add/remove the 'up' and 'down' buttons when new items are added/removed or moved.
If anyone is stuck on this, hopefully it can help you. I also removed a lot of repeated code and 'hoisted' the variables to the top of each section.
Michel Ribbens
18,417 Pointsreally good solutions and very clean code! thanks for sharing, this gives me some new ideas on how to structure my code better in the future
1 Answer
Birthe Vandermeeren
17,146 PointsNice! I had the same idea of hiding the buttons by setting their visibility to "hidden". My function is different though: first it loops through all buttons in the list to set their visibility to "visible". Then, it sets the visibility of the up button of the first item in the list and the visibility of the down button of the last item in the list to "hidden". So, no ifs and else ifs. I've posted it on the forum too, if you're interested.
Ian Salmon
Courses Plus Student 10,687 PointsIan Salmon
Courses Plus Student 10,687 PointsThis is very well done and gave me some great ideas.
I especially liked..
Thanks for sharing this with the community!