Created
September 5, 2018 11:44
-
-
Save Troland/e3f15b402c2f370921c2851ddd31291a to your computer and use it in GitHub Desktop.
// get the element index in element list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getElementIndex($list, $target) { | |
const nodes = Array.prototype.slice.call($list); | |
const elementIndex = nodes.indexOf( $target ); | |
return elementIndex; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment