Button icons and hiding text
With buttons, developers can choose to render icon-only buttons. This is accomplished by telling the button we don't want the text displayed. This is easy enough to do and serves a number of use cases—often, depending on context, an icon will suffice in explaining its action. What's more, we can add the button label back any time we wish with a simple option change. We can do this because the button text is part of the underlying HTML component. With icons, however, things become a little trickier because they're an adornment on the button. We can't turn the icons on and off as we can do with the text—the entire icon specification needs to be applied once again.
Something to aim for, then, would be a method to specify the icons in the button constructor, but remember them once turned off. This way, the icons will behave as though they're part of the original DOM element.
Getting ready
We'll start with creating the structure necessary for three icon buttons. We'll...