Disabling Elements



Write a javascript code to disable from element.

<html>
  <head>
    <title>Enable disable Element in javaScript </title>
      <script>

        function disable() 
        {
          document.forms.frm1.elements.t1.disabled = true;
        }

        function enable() 
        {
          document.forms.frm1.elements.t1.disabled = false;
        }

      </script>
    </head>
  <body>

<form name="frm1">

        Enter your name :<input type="text" name="t1">

        <input type="button" name="b1" value="Disable" onclick="disable()">

        <input type="button" name="b2" value="Enable" onclick="enable()">

    </form>        
  </body>
</html>

Output: