A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/NamedNodeMap/removeNamedItem below:

removeNamedItem ยท WebPlatform Docs

removeNamedItem Summary

Removes an attribute with a given name.

Method of dom/NamedNodeMapdom/NamedNodeMap

Syntax
var attribute = attributes.removeNamedItem();
Parameters name
Data-type
String

The name of an attribute to remove.

Return Value

Returns an object of type DOM NodeDOM Node

The removed attribute.

Examples

The following example shows how to use this method to remove an attribute from an element.

<!doctype html>
<html>
 <head>
<title>removeNamedItem example</title>
  <script>
function removeAttrib() {
    var attributes = document.getElementById("ex").attributes;
    attributes.removeNamedItem("title");
}
  </script>
 </head>
 <body>
 
 <div onclick="removeAttrib();" id="ex" title="This is a tooltip">
Click this DIV and the tooltip will be deactivated.</div>
 </body>
</html>

View live example

Notes

An attribute that is removed with this method reverts to the default value of the attribute when applicable. This method returns a script error if the user attempts to remove a non-existent attribute node. removeNamedItem was introduced in Microsoft Internet Explorer 6.

Related specifications
DOM Level 3 Core
Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4