
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
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>
Advertisements