aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/element/childelementcount/index.md
blob: 1e869a7dc28dae4d8ea206be17397e1571979d3e (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
---
title: Element.childElementCount
slug: Web/API/Element/childElementCount
tags:
  - API
  - DOM
  - プロパティ
  - リファレンス
browser-compat: api.Element.childElementCount
translation_of: Web/API/Element/childElementCount
original_slug: Web/API/ParentNode/childElementCount
---
{{ APIRef("DOM") }}

**`Element.childElementCount`** は読み取り専用のプロパティで、この要素の子要素の数を返します。

## 構文

```js
element.childElementCount;
```

## 例

```js
let sidebar = document.getElementById('sidebar');
if (sidebar.childElementCount > 0) {
  // 何かを行う
}
```

## 仕様書

{{Specifications}}

## ブラウザーの互換性

{{Compat}}

## 関連情報

- {{domxref("Document.childElementCount")}}
- {{domxref("DocumentFragment.childElementCount")}}