English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery removeAttr() Method

jQuery HTML/CSS Methods

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

To get or set HTML attributes, useattr()Method.

Syntax:

$.removeAttr(selector, attribute)

Instance

Remove style attribute from all paragraphs:

$("button").click(function(){
  $("p").removeAttr("style");
});
Test and see‹/›

Remove href attribute from all hyperlinks:

$("button").click(function(){
  $("a").removeAttr("href");
});
Test and see‹/›

Remove multiple attributes:

$("button").click(function(){
  $("p").removeAttr("id class title");
});
Test and see‹/›

Parameter Value

ParameterDescription
attributeSpecify one or more attributes (separated by spaces) to be removed

jQuery HTML/CSS Methods