Favorites

DOM Element.removeAttribute() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Element.removeAttribute()
DOM Element MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The removeAttribute() method removes an attribute from an element.

Description

The removeAttribute() method removes the named attribute. Nothing happens if the attribute isn't there. It's the right way to turn off boolean attributes such as disabled and hidden.

Removing an attribute and setting it to an empty string aren't the same: for boolean attributes, an empty value still counts as present, so disabled="" keeps the element disabled. Some attributes fall back to a default when removed, such as type on an input becoming "text".

For ARIA states, removing the attribute and setting it to "false" can mean different things; for example, removing aria-expanded says the control isn't expandable at all. Check what each attribute's absence means before choosing.

Syntax

element.removeAttribute(name)

Parameters

  • nameThe name of the attribute to remove.

Return Value

None (undefined).

Example

<input value="Now editable" disabled>
const input = document.querySelector('input');
console.log(input.disabled);
input.removeAttribute('disabled');
console.log(input.disabled);

Browser Support

The following information will show you the current browser support for the Element.removeAttribute() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee