aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/nodelist/item/index.html
blob: 8e46ba48f49efda858fde88b76573a639a625183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: NodeList.item()
slug: Web/API/NodeList/item
translation_of: Web/API/NodeList/item
---
<div>{{APIRef("DOM")}}</div>

<p class="summary"><a href="/en-US/docs/Web/API/NodeList"><code>NodeList</code></a> 의 node를 index로 돌려줍니다. 이 메서드는 인수(arguments)를 제공하는 한 exceptions 을 throw 하지 않습니다. index가 범위를 벗어나면 <code>null</code> 값이 반환되고, 인수가 제공되지 않으면 <code>TypeError</code> 가 throw 됩니다.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox"><em>nodeItem</em> = <em>nodeList</em>.item(<em>index</em>)
</pre>

<ul>
 <li><code>nodeList</code> 는 <code>NodeList</code> 입니다. 일반적으로 <a href="/en-US/docs/Web/API/Node/childNodes" title="childNodes">childNodes</a> 와 같은 다른 DOM 속성(property) 또는 메서드에서 가져옵니다.</li>
 <li><code>index</code> 는 fetch될 node의 index입니다. index는 0 에서 부터 시작합니다.</li>
 <li><code>nodeItem</code><code>item</code> 메서드가 반환 한 <code>nodeList</code> 의 node <code>index</code> 입니다.</li>
</ul>

<h2 id="Alternate_Syntax">Alternate Syntax</h2>

<p>자바스크립트는 NodeList 에서 index를 얻기 위한, 배열과 같은 브라켓 문법([])을 제공합니다 :</p>

<pre class="eval"><em>nodeItem</em> = <em>nodeList</em>[<em>index</em>]
</pre>

<h2 id="Example">Example</h2>

<pre class="brush: js">var tables = document.getElementsByTagName("table");
var firstTable = tables.item(1); // or simply tables[1] - returns the <strong>second</strong> table in the DOM
</pre>

<h2 id="Specification">Specification</h2>

<p><a class="external" href="https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-item">DOM Level 1 Core: NodeList.item()</a></p>

<p><a class="external" href="https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-844377136">DOM Level 2 Core: NodeList.item()</a></p>

<h2 id="Browser_compatibility">Browser compatibility</h2>



<p>{{Compat("api.NodeList.item")}}</p>