Похожие чаты

Can anyone tell me what im doing wrong in getting

the index of the target?
tabs.addEventListener('click', function(event) {
const target = event.target;
const targetItem = target.closest('li');

if (!target.matches('a') || targetItem.matches('.tab-selected'))
return false;

const targetParentGroup = targetItem.closest('ul[data-tabs]');

console.log(Array.from([targetParentGroup]).indexOf(targetItem))

this is my html element structure:
<ul data-tabs>
<li>Test</li>
<li>Test</li>
</ul>

2 ответов

18 просмотров

Can you explain ALL the feature you wanna do with the code?

Array.from(targetParentGroup.children)

Похожие вопросы

Карта сайта