Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Get index of child elements with event listener in JavaScript

document.getElementById("slides").addEventListener("click", function(e){
  var nodes = document.querySelectorAll('#slides > .slide');
  console.log([].indexOf.call(nodes, e.target));
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Get #index #child #elements #event #listener #JavaScript
ADD COMMENT
Topic
Name
1+9 =