offline version v3


188 of 264 menu

removeAttribute method

The removeAttribute method removes the given attribute from some tag.

Syntax

element.removeAttribute(attribute name);

Example

Let's remove the value attribute from an element:

<input id="elem" value="abcde"> let elem = document.querySelector('#elem'); elem.removeAttribute('value');

The HTML code will look like this (the value attribute will disappear):

<input id="elem">

See also

enru