Mam taką listę:
<dl>
<dt>opis A</dt>
<dd>AAA</dd>
<dt>opis B</dt>
<dd>BBB</dd>
<dl>
I do tego kod:
const opisy = document.querySelector('dl');
opisy.addEventListener('click', (e) =>
{
if (e.target.tagName == "DT")
{
console.log(e.target.nextSibling);
}
}
Wydaje się, że kliknięcie na element DT
powinno złapać element poniżej, czyli DD
. Ale łapie mi jakiś text:
Dopiero ten kod łapie DD
:
e.target.nextSibling.nextSibling.
```
O co chodzi z tym text?