A RetroSearch Logo

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

Search Query:

Showing content from https://webplatform.github.io/docs/dom/Element/getAttributeNode below:

getAttributeNode ยท WebPlatform Docs

getAttributeNode Summary

Retrieves an attribute node by name.

Method of dom/Elementdom/Element

Syntax
var attributeNode = element.getAttributeNode();
Return Value

Returns an object of type DOM NodeDOM Node

An attribute node.

Examples

The following example uses getAttributeNode to create an attribute and populate its div element. Note how the call to setAttribute changes the href value for the content attribute but not for the DOM attribute.

<!doctype html>
<html>
 <head>
  <title>Attribute Node Example</title>
  <base href="http://msdn.microsoft.com/">
  <script>
function GetAttrNode() {
  
  var o = document.getElementById("msdn");
  var sDomAttr = o.href;

  o.setAttribute('href', 'en-us/ie/default.aspx');
  var sContentAttr = o.getAttributeNode("href");
  var sOutput = ("Content attribute node value: " + sContentAttr.value +
              "<br/>DOM attribute value: " + sDomAttr);

  document.getElementById("output").innerHTML = sOutput;
}
  </script>
 </head>
 <body>
   <a id="msdn" href="en-us/default.aspx">Microsoft Developer Network</a>
   <div id="output" onmouseover="GetAttrNode()">Point here to display attribute values.</div>
 </body>
</html>
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