Menu ▼

Previous Next

readonly :

We can mention whether the control should be readonly or editable by using readonly attribute.

Syntax :

<input type="text" readonly="readonly" />


Example :

<html>

<head>

    <title>HTML Tutorial</title>

    <script language="javascript">

        function ShowInput() {

            var input = document.getElementsByName("txtinput");

            if (input.length > 0)

                alert(input[0].value);

        }

    </script>

</head>

<body>

    Readonly textbox :

    <input type="text" name="txtinput1" readonly="readonly" /><br /><br />

    Editable textbox

    <input type="text" name="txtinput2"  /><br />

</body>

</html>


Output :
HTML Tutorial Readonly textbox :

Editable textbox
Previous Next




Search dotnetlearners.com