How to get the child number ?
so when i click on the X button, that element will be removed, but it's only for item n2, so i need to get the number of the child when i click on it
<div class="col-xs-4">
<a class="postimgsd" onclick="if(confirm('Are you sure, want to delete this image?')){delImage(2572);}else{} ">
<span class="close">X</span> <img src="site/32000/2572/51c1e0a5f8715e33e74e58798cdc0f4d.jpg"></a></div>
i tired
var child = document.getElementsByClassName('col-xs-4');
var parent = child.parentNode;
var index = Array.prototype.indexOf.call(parent.children, child);
but i got
Uncaught TypeError: Cannot read property 'children' of undefined at :3:53
How can i do that ?