I think the first question you should ask yourself is: why should I enter a button in my HTML document that should not be visible?
The HTML document should be used ONLY to describe the semantics of the CONTENT. Therefore, the HTML document should ONLY contain the content that you want to publish, and additional data to explain the content of SEMANTIC !! NOTHING about how it is displayed, NOTHING, about how it behaves!
All display and behavior questions should be managed using CSS and Javascript, NEVER in the HTML itself.
Any element needed for a Javascript-only purpose should be added to the document directly using Javascript!
You should never find things like the previous / next buttons for a javascript image gallery in an HTML document, for example. The HTML document should contain only a list of images, than your JS script will change the way this list is displayed, making it a vowel gallery and add buttons for navigation.
So, in your example, your statement that you want to add an invisible button to your HTML document with some Javascript actions on it ... this is probably an example of some content that should never be in an HTML document.
source share