Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 775 Bytes

nodeIndex.md

File metadata and controls

22 lines (17 loc) · 775 Bytes

nodeIndex

Return the inde of the passed node inside the html

Parameters

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

Example

	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