Toggle Disabled Attribute in Jquery

In this article, In this article, we are going to create an HTML input box that is Toggle Disabled and Enable by a single button in Jquery.

HTML

<html >
<head>
   <title>ed</title>
      <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
     
   </head>
<body>
<div>

    <input type="text" id="tt1" /><br />

  
   <button type="button" id="btn1">Disable</button>
  
</div>
</body>
</html>

Javascript

 $(document).ready(function () {
            $('#btn1').click(function () {
               $('#tt1').prop('disabled', function(i, v) { return !v; });
            });
           
         });

I hope this code will helpful for you.