I am trying to determine the index of a clicked anchor element in my navigation using jQuery. However, when I use the following code snippet, I always get zero in the console:
$('.navigation ul li a').click(function(e) {
e.preventDefault();
var el = $(this).index();
console.log(el);
})
You can find a working example on this JSFiddle link.
If anyone has any suggestions or solutions, please let me know. Thank you.