Javascript Form How to - Make a button disappear








Question

We would like to know how to make a button disappear.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!--  ww  w  .  java2  s. c o  m-->
    document.getElementById("toggle").style.visibility="hidden";
}
</script>
</head>
<body>
  <form id="formvisiblity">
    <input id="toggle" type="submit" text="submit" name="accept" />
  </form>
</body>
</html>

The code above is rendered as follows: