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: 694

Edited on 08 Aug 2017


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">
    <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>

        function HideControl()
            document.getElementById('txt1').style = "display:none";
        function ShowControl()
            document.getElementById('txt1').style = "display:block";



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: