I need to know the index of clicked element. Can\'t figure out how to do it
for (i = 0; i < document.getElementById(\'my_div\').children.length; i++) {
getIndexOfNode: function(node){ var i = 1; while(node.previousElementSibling != null){ i++ } return i; } the function will return the index of the node passed in its parent element.
getIndexOfNode: function(node){ var i = 1; while(node.previousElementSibling != null){ i++ } return i; }