

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove disabled attribute using jQuery?
To remove disabled attribute using jQuery, use the removeAttr() method. You need to first remove the property using the prop() method. It will set the underlying Boolean value to false.
Example
You can try to run the following code to learn how to remove disabled attribute using jQuery:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.disabledCheckboxes').prop("disabled", true); $('.disabledCheckboxes').removeAttr("disabled"); $(document).ready(function(){ $('button').on('click', function() { if (this.hasAttribute("disabled")) { alert('The disabled attribute exists') } else { alert('The disabled attribute does not exist') } }) }); }); </script> </head> <body> <input type="checkbox" class="disabledCheckboxes" disabled> <input type="checkbox" class="disabledCheckboxes" disabled="disabled"> <button class='button'>Result</button> </body> </html>
- Related Questions & Answers
- How to enable the “disabled” attribute using jQuery on button click?
- How to remove an attribute from each tag using jQuery?
- HTML disabled Attribute
- jQuery :disabled Selector
- How to remove event handlers using jQuery?
- How to remove all style attributes using jQuery?
- How to remove all CSS classes using jQuery?
- How to remove all CSS classes using jQuery?
- HTML <optgroup> disabled Attribute
- HTML <input> disabled Attribute
- HTML <option> disabled Attribute
- HTML <select> disabled Attribute
- HTML <textarea> disabled Attribute
- Remove next element using jQuery?
- How to change the value of an attribute using jQuery?
Advertisements