From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/node/haschildnodes/index.html | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 files/ja/web/api/node/haschildnodes/index.html (limited to 'files/ja/web/api/node/haschildnodes') diff --git a/files/ja/web/api/node/haschildnodes/index.html b/files/ja/web/api/node/haschildnodes/index.html new file mode 100644 index 0000000000..b4ed1654d3 --- /dev/null +++ b/files/ja/web/api/node/haschildnodes/index.html @@ -0,0 +1,31 @@ +--- +title: Node.hasChildNodes +slug: Web/API/Node/hasChildNodes +tags: + - DOM + - Gecko + - Gecko DOM Reference +translation_of: Web/API/Node/hasChildNodes +--- +
+ {{ApiRef}}
+

概要

+

hasChildNodes は指定したノード子ノードを持つか否かを示す真偽値を返します。

+

構文

+
node.hasChildNodes()
+

+

"foo" を id に持つ要素の子ノードの存在を確認し、存在する場合は最初の子ノードを削除する例を以下に示します。

+
var foo = document.getElementById("foo");
+
+if ( foo.hasChildNodes() ) {
+  foo.removeChild( foo.childNodes[0] );
+}
+

仕様書

+ +

関連情報

+ -- cgit v1.2.3-54-g00ecf