Solution to challenge... please critique!
I finally did it, and it took many hours. Please let me know how it is. Somehow I have this nagging feeling I did it the hard way.
Hi, Jesse Vorvick!
Somehow I have this nagging feeling I did it the hard way.
I often have that same feeling. :)
If I understand the objective of this code challenge correctly, you want to not show the ‘up’ or ‘down’ buttons when they are not needed.
Your solution works fine to accomplish that.
Another approach would be to control the visibility of the buttons through CSS. You could use selectors to identify whether a list item was at the top or the bottom of the list. And then control the visibility of the unneeded button that is inside that list item.
A couple of ways to control whether something shows: “display: none” would hide an element and also remove it from the page flow. “visibility:hidden” would hide an element while still filling its place on the page (keeping alignment etc. the same).