[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/API/Node/nodeName [Back]  [Original]

Node: nodeName - Web API | MDN

MDN Web Docs

View in English Always switch to English

Node: nodeName

Baseline

20157

nodeName Node

Attr

Attr.name

CDATASection

"#cdata-section"

Comment

"#comment"

Document

"#document"

DocumentFragment

"#document-fragment"

DocumentType

DocumentType.name

Element

Element.tagName HTML XML SVG MathML

ProcessingInstruction

ProcessingInstruction.target

Text

"#text"

html
 HTML 
<div id="d1">Hello world</div>
<!--  -->
<span></span> <br />
<svg height="20" width="20">
  <circle cx="10" cy="10" r="5" stroke="black" stroke-width="1" fill="red" />
</svg>
<hr />
<output id="result"></output>

js
let node = document.querySelector("body").firstChild;
let result = ":<br/>";
while (node) {
  result += `${node.nodeName}<br/>`;
  node = node.nextSibling;
}

const output = document.getElementById("result");
output.innerHTML = result;

DOM
# ref-for-dom-node-nodename


Web Proxy Viewer  |  New URL  |  Original Page