Showing posts with label make checkbox invisible in html. Show all posts
Showing posts with label make checkbox invisible in html. Show all posts

How to make checkbox invisible in html



You can use javascript for this, here you have the code:

<html>
<head>
    <title>Javascript Checkbox Visibility</title>
   
    <script type="text/javascript">
   
        function showHide()
        {
            if(document.getElementById('Checkbox1').checked)
            {
                document.getElementById('Text1').style.visibility = 'visible';
            }
            else
            {
                document.getElementById('Text1').style.visibility = 'hidden';
            }
        }

    </script>

</head>
<body>

    <p>
        Check mark the checkbox to set the visiblity property of textbox.
        It will allow you to show/hide the textbox control dynamically.
    </p>
   
    <p>
        <input id="Checkbox1" type="checkbox" onclick="showHide();" checked="checked" /><label for="Checkbox1">Show/Hide</label><br /><br />
        <input id="Text1" type="text" />
    </p>

</body>
</html>