Javascript Form How to - Make a button vanish after submit








Question

We would like to know how to make a button vanish after submit.

Answer


<!DOCTYPE html>
<html>
<body>
  <p>text</p>
  <button onclick="this.style.visibility='hidden'">button1</button>
  <p>text</p>
  <button onclick="this.style.display='none'">button2</button>
  <p>text</p>
</body><!--from   ww  w  . j a v a 2 s. co m-->
</html>

The code above is rendered as follows: