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>
Can you explain ALL the feature you wanna do with the code?
Array.from(targetParentGroup.children)
Обсуждают сегодня