DOM Manipulating Attributes Removing an attribute


Example

To remove an attribute, including directly accessible properties

document.querySelector("a").removeAttribute("title");

Data attributes can also be removed as follows (modern browsers):

// remove "data-foo" attribute
delete document.querySelector("a").dataset.foo;