jQuery removeAttr() Method

jQuery removeAttr() method removes one or more attributes from selected elements.

The removeAttr() method uses the JavaScript removeAttribute() function.


Here is a syntax for the removeAttr() method

$(selector).removeAttr( attributeName );
Parameter Type Description
attributeName String Optional. Specifies one or more attributes to remove, it can be a space separated list of attributes.


Here, in this example removeAttr() method call on selected elements when click on button.

<!DOCTYPE html>
  <title>jQuery removeAttr() method</title>
  <script src="jquery-latest.min.js"></script>
        $("p").removeAttr("style title");
    <p style="background-color: yellow; text-align: center;" title="First Paragraph">First paragraph start here...</p>
  <button>Click here to call removeAttr() method</button>

Run it...   »