Saturday, August 26, 2017

Javascript : Show and hide div

In this article I am going to explain how to show and hide DIV using Javascript.

I want to hide and show the div on button click using Javascript.


Here is the example:

Complete HTML markup:

<html xmlns="">
<head runat="server">
               <script type="text/javascript">
                   function FunShowhide() {
                       var value = document.getElementById("btnhide").value;
                if (value == "Hide") {                  
                    document.getElementById("aspmantra").style.display = "none";
                    document.getElementById("btnhide").value = 'Show';
                    document.getElementById("aspmantra").style.display = "block";
                    document.getElementById("btnhide").value = 'Hide';
    <form id="form1" runat="server">
        <input type="button" id="btnhide" onclick="FunShowhide()" value="Hide"> <br />   
        <div id="aspmantra">          
                   <a href=""><img src="images/aspmantra.png" /></a>           


how to show and hide DIV using Javascript

No comments:

Post a Comment