How can I make a button invisible by clicking another button in HTML?
I have written like below, but it doesn't work.
<input type="button" onclick="demoShow();" value="edit" />
<script type="text/javascript">
function demoShow()
{ document.getElementsByName('p2').style.visibility="hidden"; }
</script>
<input id="p2" type="submit" value="submit" name="submit" />
A hidden attribute on a <button> tag hides the button. Although the button is not visible, its position on the page is maintained.
style. display = "none"; // or button. visibility = hidden; This code may help you.
write this
To hide
{document.getElementById("p2").style.display="none";}
to show
{document.getElementById("p2").style.display="block";}
Use the id
of the element to do the same.
document.getElementById(id).style.visibility = 'hidden';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With