How to disable a textbox using JavaScript

{0 Comments}

To disable a text box using JavaScript you can following syntax which will help you disable textbox.

 Javascript |  copy code |? 
1
<script type="text/javascript">
2
       function disable() {
3
           document.getElementById( "Text1" ).disabled = 'true';
4
       }
5
 
6
        </script>

 HTML |  copy code |? 
1
<div >
2
            <input id="Text1"  type="text" />
3
        </div>
4
        <input id="Button1" type="button" value="hide" onclick="disable()" />

Leave a Comment

Your email address will not be published.