On my page.php
I have 3 buttons :
<input type="submit" value="Btn 1" id="btn1">
<input type="submit" value="Btn 2" id="btn2" onClick="action();>
<input type="submit" value="Btn 3" id="btn3" onClick="action();>
first Btn 1
button hidden with load:
document.getElementById('btn1').style.visibility = 'hidden';
with click on Btn 2
or Btn 3
I want hide Btn 2
or Btn 3
and show Btn 1
:
var hidden = false;
function action() {
hidden = !hidden;
if(hidden) {
document.getElementById('btn1').style.visibility = 'visible';
document.getElementById('btn2').style.visibility = 'hidden';
document.getElementById('btn3').style.visibility = 'hidden';
}
}
this way hidden button Btn 1
leaves empty space in place where it was visible, or if I put it below Btn 2
and Btn 3
then I got two empty spaces in places of Btn 2
and Btn 3
.
How it is possible show and hide buttons in same place on html
page