Answer the question
In order to leave comments, you need to log in
Why does this happen when iterating over an array?
There is a loop like this:
end: function (event) {
this.period_day.forEach(function (day) {
document.getElementsByName(day).forEach(function (operating_room) {
operating_room.childNodes.forEach(function (operation) {
console.log(operation)
})
})
})
}
<div id="7"><div operation="7" class="border border-dark rounded bg-white" style="margin: 2px;"><button class="btn-sm btn-danger">Удалить из плана </button> <br>Операционная: 1 Очередь:
<br>Дата операции: <b>2018-04-01</b>
Ф.И.О.: <b>Васильев</b> <b>Василий</b> <b>Васильевич</b>
Возраст: <b>1992-02-02</b> <br>МК№ <b>2</b> Дата поступления: <b>2018-03-06</b> <br>Диагноз: <b>Сосудистая мальформация щечной области слева; состояние после ряда операций</b> МКБ-X <b>Q27.3</b> <span class="bg-danger">Сопутсвующие заболевания: <b>Сахарный диабет II типа</b></span> <br>Операция: <b>Блоковая резекция с применением лазерного воздействия и прошиванием с применением компрессионных валиков</b></div></div>
<div id="8"><!----></div>
end: function (event) {
this.period_day.forEach(function (day) {
document.getElementsByName(day).forEach(function (operating_room) {
operating_room.childNodes.forEach(function (operation) {
operation.childNodes.forEach(function (patient) {
console.log(patient)
})
})
})
})
},
<!---->
<!---->
<div operation="7" class="border border-dark rounded bg-white" style="margin: 2px;"><button class="btn-sm btn-danger">Удалить из
плана
</button> <br>Операционная: 1 Очередь:
<br>Дата операции: <b>2018-04-01</b>
Ф.И.О.: <b>Васильев</b> <b>Василий</b> <b>Васильевич</b>
Возраст: <b>1992-02-02</b> <br>МК№ <b>2</b> Дата поступления: <b>2018-03-06</b> <br>Диагноз: <b>Сосудистая мальформация щечной области слева; состояние после ряда операций</b> МКБ-X <b>Q27.3</b> <span class="bg-danger">Сопутсвующие заболевания: <b>Сахарный диабет II типа</b></span> <br>Операция: <b>Блоковая резекция с применением лазерного воздействия и прошиванием с применением компрессионных валиков</b></div>
<!---->
Answer the question
In order to leave comments, you need to log in
But nothing that id should not be numbers?
For a second, in browsers, all id's are translated into variables with the same names:
in js, the some variable will refer to this div.
and more... getElementsByName returns all elements with the specified name attribute.
Something I point blank in your html-code I do not see any element with this attribute.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question