How to remove “disabled” attribute from HTML input element using JavaScript ? Last Updated : 29 Jan, 2024 Comments Improve Suggest changes Like Article Like Report In HTML, we use input elements for user input. The 'disabled' property helps prevent interaction with these elements. For example, if we only want users over 18 to input their Adhar card numbers, we can use JavaScript to remove the 'disabled' attribute when the user enters an age greater than 18. This ensures that users can only input Adhar card numbers if they meet the specified age requirement. Here, we will learn various approaches to remove the disabled attribute from the HTML input element using JavaScript. Table of Content Using the removeAttribute() methodModifying the 'disabled' propertyUsing the removeAttribute() methodThe 'removeAttribute( )' method in JavaScript is used to eliminate a specific attribute, such as "disabled," from an HTML element, enabling user interaction. Syntax:document.getElementById('geeks').removeAttribute('disabled');Example: This example implements the use of the removeAttribute() method to remove the disabled attribute from the HTML input element. html <!DOCTYPE html> <html> <head> <title> To remove “disabled” attribute from HTML input element </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <p>Click on the button to remove disabled attribute</p> Type: <input id="input" disabled /><br><br> <button onclick="myGFG()">Click Here</button> <p id="gfg"></p> <script> let down = document.getElementById("gfg"); function myGFG() { document.getElementById('input').removeAttribute('disabled'); down.innerHTML = "Disabled Attribute removed"; } </script> </body> </html> Output: Modifying the 'disabled' propertyIn this method, we change the 'disabled' property value to 'false' instead of removing the 'disabled' property itself from an HTML element. The 'disabled' property, by default, is 'true', and setting it to 'false' achieves the same result as removing the 'disabled' property. Example: This example implements the use of thedisabled property to remove the disabled attribute from the HTML input element. html <!DOCTYPE HTML> <html> <head> <title> To remove “disabled” attribute from HTML input element </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <p>Click on the button to remove disabled attribute</p> Type: <input id="input" disabled /><br><br> <button onclick="myGFG()">Click Here</button> <p id="gfg"></p> <script> let down = document.getElementById("gfg"); function myGFG() { let input = document.getElementsByClassName('inputClass'); for (var i = 0; i < input.length; i++) { input[i].disabled = false; } down.innerHTML = "Disabled Attribute removed"; } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to remove “disabled” attribute from HTML input element using JavaScript ? P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to remove all attributes of an HTML element using jQuery ? In this article, we will see how to remove all attributes of an HTML element using jQuery. To remove all attributes of elements, we use the removeAttributeNode() method and .removeAllAttributes(). Syntax: $.fn.removeAllAttributes = function() { return this.each(function() { $.each(this.attributes, f 1 min read JQuery | Remove âdisabledâ attribute from an element There is an Input Element which is disabled, the task is to enable it using JQuery. Here are a few examples discussed. To understand example first few methods to know. JQuery prop() method This method set/return properties and values of selected elements. If we use this method to return the property 2 min read Which attribute is used to disabled the specific input field in HTML Form ? HTML5 introduced many attributes that are used for developing an efficient webpage. In this article, we will learn to disable the particular input field by using the "disable" attribute with the specific type of input. The disabled attribute is a boolean attribute that is used to vandalize the input 1 min read How to Disable Button Element Dynamically using JavaScript? The disabled property in the HTML DOM is used to control the interactivity of a button element. When this property is set, the button becomes unclickable and inactive, effectively preventing any user interaction. This property accepts a boolean value, allowing developers to dynamically enable or dis 1 min read How to disable radio button using JavaScript ? Radio buttons let users select one option from many, commonly used in forms. Sometimes, based on a user's previous choice, certain options need to be disabled. For example, if a user selects "No" to playing games, we can disable related game options. Using JavaScript, about 65% of forms use such log 4 min read 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 create a Disabled Input using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Input using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=âstylesheetâ hre 1 min read How to specify that a group of related form elements should be disabled using HTML? In this article, we will learn how to specify that a group of related form elements should be disabled using HTML. When the disabled attribute is present, it specifies that the input field is disabled. We can not write any content in a disabled input field. Approach: We will be using the disabled at 1 min read How to remove clickable behavior from a disabled link using jQuery ? In this article, we will see how to remove the clickable behavior from a disabled link using jQuery. To remove the clickable behavior, we will use the removeAttr() method. The removeAttr() method is used to remove one or more attributes from the selected elements. Syntax: $(selector).removeAttr(attr 1 min read How to disable HTML links using JavaScript / jQuery ? Given an HTML link and the task is to disable the link by using JavaScript/jQuery. Approach 1: Disable HTML link using JavaScript using setAttribute() Method. JavaScript setAttribute() Method: This method adds the defined attribute to an element and gives it to the passed value. In case of the speci 5 min read Like