Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
HTMLCollection の item() メソッドは、この集合の中で指定された位置にあるノードを返します。
メモ: HTMLCollection の中身はライブであるため、その背景にある DOM が変化すると、子の集合内にある個々のノードの位置は変化する可能性があり、インデックス値が指定されたノードを差し続けなくなる可能性があります。
返す Node の位置。要素は HTMLCollection 内で、文書内のソースに現れる順序と同じ順序で現れます。
指定したインデックスにある Node、または index が 0 より小さいか length プロパティ以上の場合は null です。
item() メソッドは HTMLCollection から番号付けされた要素を返します。JavaScript で HTMLCollection を配列として扱い、配列記法を使用してインデックスを作成する方が簡単です。下記の例を参照してください。
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年7月22日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.