Pages

Thursday, December 2, 2010

Update to “Hiding Buttons and MenuItems”

I’ve just made some dramatic improvements to the code in the “Improved Code for Hiding Buttons and MenuItems” post.  It eliminates the usage of the on-the-fly style changes, which in certain situations does not hold properly, causing the element to become visible again.

Instead of style changes, I’ve opted to use the removeChild() DOM method.  Since, however, functions to restore the button/menu item are obsoleted by this change, I’ve also included instructions and mechanisms for using insertBefore() to restore the button/menu item to its original location.

If you’ve been frustrated by reappearing elements, or wanted truly dynamic control over concealing and revealing them, visit that post immediately.