Home Javascript Javascriptexamples JavaScript Hide Button
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JavaScript Hide Button

Advertisement
This page discusses - JavaScript Hide Button

JavaScript Hide Button

        

In this section, you will learn how to hide the button using JavaScript.

In the given example, we have created a button. The document object grabs the button and refers to property 'visibility' with style object. The 'visibility' property makes the element visible or invisible. Now, if you apply the visibility property with the 'hidden' value to the button, the button will disappear. When you load the page you will get the button. On clicking the button, the function hide() is called,  that makes the button invisible.

Here is the code:

<html>
<h2>Hide Button</h2>
<script>
function hide(){
document.button.butt.style.visibility = 'hidden';
return;
}
</script>
<form name = "button" style="VISIBILITY: visible">
<input type = "button" name="butt" onClick = "hide();" value= "Click Here">
</form>
</html>

Output will be displayed as:

When you click the button, the button gets removed.

Download Source Code:

        

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Ask Questions?    Discuss: JavaScript Hide Button  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com