blob: c3520c9a3155c3067967c881f4824e1a369396b8 (
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
|
---
title: Element.childElementCount
slug: Web/API/Element/childElementCount
tags:
- API
- DOM
- Property
- Reference
browser-compat: api.Element.childElementCount
translation_of: Web/API/Element/childElementCount
original_slug: Web/API/ParentNode/childElementCount
---
<div>{{ APIRef("DOM") }}</div>
<p><code><strong>Element.childElementCount</strong></code> は読み取り専用のプロパティで、この要素の子要素の数を返します。</p>
<h2 id="Syntax">構文</h2>
<pre class="brush: js">element.childElementCount;</pre>
<h2 id="Example">例</h2>
<pre class="brush:js">let sidebar = document.getElementById('sidebar');
if (sidebar.childElementCount > 0) {
// 何もしない
}
</pre>
<h2 id="Specifications">仕様書</h2>
{{Specifications}}
<h2 id="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat}}</p>
<h2 id="See_also">関連情報</h2>
<ul>
<li>{{domxref("Document.childElementCount")}}</li>
<li>{{domxref("DocumentFragment.childElementCount")}}</li>
</ul>
|