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 :



    <title>HTML Tutorial</title>

    <script language="javascript">

        function ShowInput() {

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

            if (input.length > 0)






    Readonly textbox :

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

    Editable textbox

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



Output :
HTML Tutorial Readonly textbox :

Editable textbox
Previous Next