element-index
v1.0.1
Published
HTMLElement index as a proto function
Downloads
64
Readme
Element index
HTMLElement DOM tree position as a proto function.
Installation
npm i element-index --save
Implementation
HTML
<ul>
<li></li>
<li></li>
<li class="is-active"></li>
</ul>
JS
import 'element-index';
document.querySelector('.is-active').index(); // returns 2