Exploring the solution further, grooveplex pointed out that without reviewing your complete markup and css, providing a precise answer is challenging. But don't worry, we understand this is your first time here.
If you wish to hide a button once it's clicked, you can achieve this by attaching a click event listener to all buttons and assigning a specific class to the clicked button. This class can then be styled accordingly for the desired post-click appearance. Using 'visibility: hidden' would likely be ideal as it maintains the visual keyboard's structure.
// acquire all buttons
var documentButtons = document.getElementsByTagName('button');
// attach an event listener to all buttons
for (var i = documentButtons.length - 1; i >= 0; i--) {
documentButtons[i].addEventListener('click', removeButton);
}
// function to remove the button (cross browser)
function removeButton(e) {
// define variables
var name, arr;
// class name definition
name = "hidden";
// where to add the class name
arr = e.target.className.split(" ");
// adding the class name
if (arr.indexOf(name) == -1) {
e.target.className += " " + name;
}
}
.hidden {
visibility: hidden;
}
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
<button>Button 4</button>
<button>Button 5</button>