diff options
author | Atsuto Yamashita <atyamash@yahoo-corp.jp> | 2022-03-15 19:47:35 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-15 19:47:35 +0900 |
commit | 9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0 (patch) | |
tree | 71952407ea41c86feabef4214610d59e15aae55d /files/ja/web/api/element/nextelementsibling/index.md | |
parent | c2678137db5f97ad1fe39e872529159a1afafec1 (diff) | |
parent | 9e7fbb013772ebab9b35185f0d0836995acbe6db (diff) | |
download | translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.gz translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.bz2 translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.zip |
Merge branch 'main' into fix-typo-client-side-web-apis-intro-ja
Diffstat (limited to 'files/ja/web/api/element/nextelementsibling/index.md')
-rw-r--r-- | files/ja/web/api/element/nextelementsibling/index.md | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/files/ja/web/api/element/nextelementsibling/index.md b/files/ja/web/api/element/nextelementsibling/index.md new file mode 100644 index 0000000000..ea24a59878 --- /dev/null +++ b/files/ja/web/api/element/nextelementsibling/index.md @@ -0,0 +1,59 @@ +--- +title: Element.nextElementSibling +slug: Web/API/Element/nextElementSibling +tags: + - API + - DOM + - Element + - プロパティ +browser-compat: api.Element.nextElementSibling +translation_of: Web/API/Element/nextElementSibling +--- +{{APIRef("DOM")}} + +**`Element.nextElementSibling`** は読み取り専用のプロパティで、この要素の親の子リスト内ですぐ次にある要素を返します。このノードがリストの最後のノードであった場合は `null` を返します。 + +## 構文 + +```js +// ゲッター +element = el.nextElementSibling; + +// セッターなし。読み取り専用プロパティ +``` + +## 例 + +```html +<div id="div-01">Here is div-01</div> +<div id="div-02">Here is div-02</div> + +<script type="text/javascript"> + 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: +DIV +SCRIPT +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{domxref("Element.previousElementSibling")}} |