jQuery | disable/enable an input element Last Updated : 28 Mar, 2019 Comments Improve Suggest changes Like Article Like Report The disable/enable an input element in jQuery can be done by using prop() method. The prop() method is used to set or return properties and values for the selected elements. Example 1: This example uses prop() method to disable the input text field. html <!DOCTYPE html> <html> <head> <title> JavaScript enable/disable an input element </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <body style = "text-align:center;"> <h1 style = "color:green;" > GeeksForGeeks </h1> <input id = "input" type="text" name="input"/> <button onclick="enable_disable()"> Enable/Disable </button> <!-- Script to disable input text area --> <script> function enable_disable() { $("input").prop('disabled', true); } </script> </body> </html> Output: Before clicking the button: After clicking the button: Example 2: This example uses prop() method to enable the input text field. html <!DOCTYPE html> <html> <head> <title> JavaScript enable/disable an input element </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <body style = "text-align:center;"> <h1 style = "color:green;" > GeeksForGeeks </h1> <input id = "input" type="text" name="input" disabled/> <button onclick="enable_disable()"> Enable/Disable </button> <!-- Script to enable input text fields --> <script> function enable_disable() { $("input").prop('disabled', false); } </script> </body> </html> Output: Before clicking the button: After clicking the button: Comment More infoAdvertise with us Next Article jQuery | disable/enable an input element P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JQuery Similar Reads How to enable/disable all input controls inside a form element using jQuery ? Give an HTML document containing a form element. The form element contains input elements, option elements, and button elements. The task is to enable or disable all input controls inside a form using jQuery. It can be done by using prop() method. Using prop() Method: It is used to set or return the 3 min read How to find all input elements that are enabled using jQuery? The jQuery " :enabled" pseudo-class selector helps to find all the input element that are enabled. This pseudo-class selector should only be used for selecting HTML elements that support the disabled attribute i.e (<button>, <input>, <textarea>, <select>, <option>, < 2 min read How to find all elements that are disabled in jQuery ? In this article, we will learn how to find all elements on the page that are disabled using jQuery. Approach: The :disabled selector can be used to get all elements on the page that are currently disabled. These elements are iterated over using the each() method. The elements can then be individuall 2 min read How to enable/disable a button using jQuery ? Enabling/disabling a button using jQuery involves altering its functionality to either accept user input or not. This is typically done by manipulating its 'disabled' property or attribute through jQuery methods like `.prop()` or .attr().To enable/disable a button using jQuery, you'll need a basic H 2 min read How to specify that an input element should be disabled? The disabled attribute for <input> element is used to specify that the input field is disabled. A disabled input is un-clickable and unusable. It is a boolean attribute. The disabled <input> elements are not submitted in the form. Syntax:<input disabled>Example: In this example, to 1 min read Like