diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/node/haschildnodes | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/api/node/haschildnodes')
-rw-r--r-- | files/ja/web/api/node/haschildnodes/index.html | 31 |
1 files changed, 31 insertions, 0 deletions
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 +--- +<div> + {{ApiRef}}</div> +<h2 id="Summary" name="Summary">概要</h2> +<p><strong>hasChildNodes</strong> は指定した<a href="/ja/docs/Web/API/Node">ノード</a>が<a href="/ja/docs/Web/API/Node.childNodes">子ノード</a>を持つか否かを示す<a href="/ja/docs/JavaScript/Reference/Global_Objects/Boolean">真偽値</a>を返します。</p> +<h2 id="Syntax" name="Syntax">構文</h2> +<pre class="syntaxbox"><code>node.hasChildNodes()</code></pre> +<h2 id="Example" name="Example">例</h2> +<p><code>"foo"</code> を id に持つ要素の子ノードの存在を確認し、存在する場合は最初の子ノードを削除する例を以下に示します。</p> +<pre class="brush:js;highlight:[3];">var foo = document.getElementById("foo"); + +if ( foo.hasChildNodes() ) { + foo.removeChild( foo.childNodes[0] ); +}</pre> +<h2 id="Specification" name="Specification">仕様書</h2> +<ul> + <li><a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-810594187">hasChildNodes</a></li> +</ul> +<h2 id="See_also" name="See_also">関連情報</h2> +<ul> + <li>{{domxref("Node.childNodes")}}</li> + <li>{{domxref("Node.hasAttributes")}}</li> +</ul> |