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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![hamsternation](https://uploads.teamtreehouse.com/production/profile-photos/6960502/micro__DSC3093.jpg)
hamsternation
26,616 PointsAnother way to make the button disappear
I tried to make the button before watching the video and accidentally stumbled on another way to make the button disappear without setting the display to none.
If you place the button element:
<button id="load" onclick="myButton()">Load Page!</button>
Inside the div with the id "ajax"
, the callback function will automatically overwrite the innerHTML
of that div with the callback function content and the button disappears.
Is there any considerations with this method? I'm thinking using the display = none method makes the button display "reversible" so that one could make the button appears again for whatever reason in the future.
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThere are many ways to delete an element, any of them could be used to make the button go away permanently.
But as you observed, an advantage of setting the "display" style is that is can be reversed later if you want the button to re-appear.