DOM: Remove Element's Attribute Value

By Xah Lee. Date: . Last updated: .

node.removeAttribute(attribute_name) → Remove the attribute. No error if attribute doesn't exist. Return undefined.

The node is a HTML element object.

attribute_name is a string.

// remove the value of attribute “href” in first link element
const tt = document.getElementsByTagName("a")[0];
tt.removeAttribute("href");
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


DOM

Overview

Basic Examples

HTML Input

Web Scripting Examples

Web Scripting Misc

jQuery

node.js