Link to home
Start Free TrialLog in
Avatar of johnkainn
johnkainn

asked on

javascript hide div

Why does this not hide the div?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
      <title></title>
      <script type="text/javascript">
            function showstuff(control1, show) {
                  document.getElementById(control1).style.visibility = show;
            }
      </script>
</head>
<body>
      <form id="form1" runat="server">
            <div id="div1">
                  Here is some text that I want to hide
            </div>
            <button id="btn1" onclick="showstuff('div1','hidden')"></button>
      </form>
</body>
</html>
Avatar of santhimurthyd
santhimurthyd
Flag of United States of America image

check out this

https://www.experts-exchange.com/questions/27908991/How-to-find-Height-of-a-text-filed-in-pixels-or.html

in the style use the option

To hide
document.getElementById("TEMPLATE2").style.display = none;

To make it visible
document.getElementById("TEMPLATE2").style.display = block;
ASKER CERTIFIED SOLUTION
Avatar of John Easton
John Easton
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial