UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Javascript show hidden control

Code, demo for show hidden controls in javascript.

by Athil


Posted on 11 May 2017 Category: Javascript Views: 481

Edited on 08 Aug 2017



DEMO

Hi, here I am going to show how to show a hidden control in javascript.

document.getElementById('control-id').style = "display:block";

Full Code

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <h1>Demo for hide/Show  in javascript </h1>

    <input type="text" id="txt1"/> <br/>
    <button type="submit" onclick="HideControl();">Hide </button>
    <button type="submit" onclick="ShowControl();">Show </button>
</body>

    <script>
        function HideControl()
        {
            document.getElementById('txt1').style = "display:none";
        }
        function ShowControl()
        {
            document.getElementById('txt1').style = "display:block";
        }
        </script>

</html>

 

Related Articles

How to hide a control using javascript

How to hide a control using jQuery

How to show hidden controls in jQuery

Show and hide controls in single Event



Leave a Comment:


Advertisement