Node: hasChildNodes() メソッド
構文
js
hasChildNodes()
引数
なし。
返値
論理値で、このノードに子ノードがあれば true を、そうでなければ false を返します。
例
js
let foo = document.getElementById("foo");
if (foo.hasChildNodes()) {
// 'foo.childNodes' で何かを行う
}
仕様書
| Specification |
|---|
| DOM Standard # ref-for-dom-node-haschildnodes① |
ブラウザーの互換性
BCD tables only load in the browser