Movatterモバイル変換


[0]ホーム

URL:


  1. 開発者向けのウェブ技術
  2. Web API
  3. Element
  4. nextElementSibling

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。

View in EnglishAlways switch to English

Element: nextElementSibling プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

Element.nextElementSibling は読み取り専用のプロパティで、この要素の親の子リスト内ですぐ次にある要素を返します。このノードがリストの最後のノードであった場合はnull を返します。

Element オブジェクト、またはnull です。

html
<div>Here is div-01</div><div>Here is div-02</div><script>  let el = document.getElementById("div-01").nextElementSibling;  console.log("Siblings of div-01:");  while (el) {    console.log(el.nodeName);    el = el.nextElementSibling;  }</script>

この例は読み込み時に、コンソールに以下のような出力を行います。

Siblings of div-01:DIVSCRIPT

仕様書

Specification
DOM
# ref-for-dom-nondocumenttypechildnode-nextelementsibling②

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp