aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/document/childelementcount/index.html
blob: fcd6244dd002bb5abd0fa7e591e072745cafc7b2 (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
45
46
---
title: Document.childElementCount
slug: Web/API/Document/childElementCount
tags:
  - API
  - DOM
  - Property
  - Reference
browser-compat: api.Document.childElementCount
translation_of: Web/API/Document/childElementCount
---
<div>{{ APIRef("DOM") }}</div>

<p><code><strong>Document.childElementCount</strong></code> は読み取り専用のプロパティで、文書の子要素の数を返します。</p>

<p>特定の要素の子要素の数を取得する場合は、 {{domxref("Element.childElementCount")}} を参照してください。</p>

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

<pre class="brush: js"><em>document</em>.childElementCount;
</pre>

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

<pre class="brush:js">
document.children;
// HTMLCollection で、ふつうは &lt;html&gt; 要素をこの文書の唯一の子として含んでいる

document.childElementCount;
// 1
</pre>

<h2 id="Specifications">仕様書</h2>

{{Specifications}}

<h2 id="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat}}</p>

<h2 id="See_also">関連情報</h2>

<ul>
  <li>{{domxref("Element.childElementCount")}}</li>
  <li>{{domxref("DocumentFragment.childElementCount")}}</li>
</ul>