9951 explained code solutions for 126 technologies


jqueryHow do I remove an attribute using jQuery?


jQuery provides an easy way to remove attributes from HTML elements. To remove an attribute using jQuery, you can use the removeAttr() method.

Example code

$('#myElement').removeAttr('disabled');

This code will remove the disabled attribute from the element with the ID myElement.

The code consists of two parts:

  1. $('#myElement') - this part selects the element with the ID myElement.
  2. removeAttr('disabled') - this part removes the disabled attribute from the selected element.

For more information, see the jQuery API Documentation.

Edit this code on GitHub