I was wondering how you can return the value of which specific child has been clicked within an index.
Normally the default behavior would be to use
var selected = $(this).index();
Although this works as it should , it doesn’t return the index from INSIDE a function such as the following.
var selected;
$(container.children()).on('click', function() {
selected = $(this).index();
selected.siblings().fadeOut();
selected.animate({
width: 920,
height: 440
});
selected.fadeOut();
});
//console.log(selected) = 'undefined'!
Why is this and what is the appropriate solution?!
EDIT:
Please note, I have edited this to make the question less specific and localized, in order for it to gain a better vote.
Rick
Simply: