Occasionally it is important to allow only one tap on a web page element. A form submit button, for example, which this article describes how to do.
To prevent a second tap on something, what was tapped needs to disappear. It might just go poof, or it might get covered. This article describes how to make it go poof.
Here is an illustration. When you tap the button below, it disappears.
Reload the page to make the button appear again.
This is the source code of the above illustration.
<input
style="visibility:visible"
onclick="this.style.visibility='hidden'"
type="button"
value="Tap Me and I Go Poof">
The page is loaded with the button CSS being visibility:visible. When the button is tapped, this.style.visibility='hidden' turns visibility into hidden.
The reason to use property visibility instead of display is so the button can be removed without reflowing the entire web page. The button goes poof, but the space it occupied does not close up.
Now you know. :-)
(This content first appeared in Possibilities newsletter.)
Will Bontrager
Was this blog post helpful to you? (anonymous form)
All information in WillMaster Blog articles is presented AS-IS.
We only suggest and recommend what we believe is of value.
As remuneration for the time and research involved to provide quality links,
we generally use affiliate links when we can.
Whenever we link to something not our own, you should assume
they are affiliate links or that we benefit in some way.
While an app's IP address can always be found in the REMOTE_ADDR value, the value might not be the actual destination of the content retrieved from your website.