Return the inde of the passed node inside the html
Name | Type | Description | Status | Default |
---|---|---|---|---|
node | { HTMLElement } | The node to get the index for | required |
Return { Integer } The index of the node inside the html
import nodeIndex from 'coffeekraken-sugar/js/dom/nodeIndex'
// assuming:
// <li>item #1</li>
// <li class="match">item #2</li>
// <li>item #3</li>
nodeIndex(document.querySelector('.match')) // 1
Author : Olivier Bossel [email protected] https://olivierbossel.com