Select elements, pass the attribute name(s), and chain if needed.
Select the element(s) that have the attribute.
Call .removeAttr("name") — or several names separated by spaces (1.7+).
Confirm with .attr("name") — expect undefined when gone.
Prefer .prop("onclick", null) to clear inline handlers in legacy IE.
Use .removeClass() for class names, not .removeAttr("class"), in most apps.
Piece
Required?
Role
attributeName
Yes
One name, or space-separated list since 1.7
Return
—
Same jQuery object (chainable)
Scope
—
Every matched element
Native under the hood
—
removeAttribute() with jQuery naming fixes
Pseudocode
Pseudocode
call .removeAttr(attributeName)
names = split attributeName on spaces
for each matched element:
for each name in names:
removeAttribute(name)
return the jQuery collection
Reference
Cheat Sheet
Keep these facts handy when stripping attributes from markup.
Topic
Detail
Since
jQuery 1.0 · multi-name list since 1.7
vs .attr(name, null)
Equivalent removal
Missing attribute
Safe — no error if already absent
After removal
.attr(name) → undefined (1.6+)
IE onclick
Use .prop("onclick", null)
Classes
Prefer .removeClass()
Native properties
Do not use .removeProp() on checked/disabled
Try it
Live Preview
Toggle or strip attributes on the sample input — same APIs as the examples below.
Sample element: the text input below. Hover it when title is set to see the tooltip.
Result
Ready — pick an action and click Run.
Code
jQuery Examples
Short, copy-ready snippets. Prefer .removeAttr() when removal is the goal.
Example 1 — Official Toggle Title
Add and remove title on an input — the documented demo pattern.
jQuery
var inputTitle = $("input").attr("title");
$("button").on("click", function () {
var input = $(this).next();
if (input.attr("title") === inputTitle) {
input.removeAttr("title");
} else {
input.attr("title", inputTitle);
}
$("#log").text("input title is now " + input.attr("title"));
});
onclick property: null
(button no longer runs the inline handler)
How It Works
Problem..removeAttr("onclick") fails in some IE versions.
Fix. Set the live property to null with .prop().
Check. Native element.onclick becomes null.
Prefer. Use .on() / .off() for modern handlers.
Edge Cases & Pitfalls
Watch for these when stripping attributes.
IE
onclick needs .prop()
Do not rely on .removeAttr("onclick") in IE 8–11. Use .prop("onclick", null).
class
Prefer .removeClass()
.removeAttr("class") wipes the whole attribute. Class helpers remove names safely.
boolean
Removing disabled ≠ enabling via property alone
For live enable/disable, set .prop("disabled", false). Attribute and property can diverge.
native
Do not .removeProp() native properties
.removeProp() is for custom properties. Reset natives with .prop(name, false) instead.
Compatibility
Browser Support
.removeAttr() has been part of jQuery since 1.0. Space-separated multi-attribute removal since 1.7. Works wherever your loaded jQuery build runs.
✓ Stable · jQuery 1.0+
jQuery .removeAttr()
Universal across browsers that run your jQuery version. Prefer current jQuery 3.x+; use .prop for IE onclick edge cases.
100%jQuery core
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.removeAttr()Universal
Bottom line: Safe for everyday apps. Use .removeAttr() for HTML attributes; clear onclick with .prop in legacy IE.
Analysis
Performance Notes
Approach
Cost
Best for
One .removeAttr()
Cheap
Typical UI cleanup
Space-separated list
Cheap
Removing a few related attrs
Huge selections in a loop
Costly
One selection + one call instead
Removal is inexpensive. Prefer one selection and a multi-name call over repeated queries inside tight loops.
Remember
Key Takeaways
Role: remove HTML attributes from every matched element.
1.7+: space-separated names remove several at once.
Alias:.attr(name, null) does the same removal.
IE: clear onclick with .prop("onclick", null).
One line:.removeAttr() strips HTML attributes — use .prop() when you need to clear a live property like onclick.
Frequently Asked Questions
.removeAttr() removes one or more HTML attributes from every matched element. It wraps native removeAttribute() with jQuery chaining and cross-browser attribute naming. Available since jQuery 1.0.
They both remove the attribute. Prefer .removeAttr("title") when removal is the intent, or .attr("title", null) when you already use .attr() nearby.
Yes. Since jQuery 1.7, pass a space-separated list: .removeAttr("title data-role"). Each name is removed from every matched element.
Yes. It removes the attribute(s) from every element in the collection and returns the jQuery object for chaining.
In IE 8, 9, and 11, removing inline onclick with .removeAttr() is unreliable. Clear the property instead: .prop("onclick", null).
Prefer .removeClass() for CSS classes. Use .removeAttr("class") only when you need to strip the entire class attribute from the markup.