From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/ru/web/api/node/haschildnodes/index.html | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 files/ru/web/api/node/haschildnodes/index.html (limited to 'files/ru/web/api/node/haschildnodes/index.html') diff --git a/files/ru/web/api/node/haschildnodes/index.html b/files/ru/web/api/node/haschildnodes/index.html new file mode 100644 index 0000000000..947072dfe6 --- /dev/null +++ b/files/ru/web/api/node/haschildnodes/index.html @@ -0,0 +1,37 @@ +--- +title: Node.hasChildNodes() +slug: Web/API/Node/hasChildNodes +translation_of: Web/API/Node/hasChildNodes +--- +
+
{{APIRef("DOM")}}
+
+ +

Метод Node.hasChildNodes() возвращает {{jsxref("Boolean")}} значение показывающее имеет ли текущий {{domxref("Node")}} дочерние узлы или нет.

+ +

Синтаксис

+ +
node.hasChildNodes()
+ +

Пример

+ +

Следующий пример удаляет первый дочерний узел внутри элемента с id "foo", если foo имеет дочерние узлы.

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

Спецификация

+ + + +

Смотрите также

+ + -- cgit v1.2.3-54-g00ecf