English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The removeAttr() method removes one or more attributes from the selected elements.
To get or set HTML attributes, useattr()Method.
$.removeAttr(selector, attribute)
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 | Description |
---|---|
attribute | Specify one or more attributes (separated by spaces) to be removed |