Return JQuery specific click in a container
<p>I was wondering how you can return the value of which specific child has been clicked within an index.</p>

<p>Normally the default behavior would be to use</p>

<pre><code>var selected = $(this).index();
</code></pre>

<p>Although this works as it should , it doesn't return the index from INSIDE a function such as the following.</p>

<pre><code>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'!
</code></pre>

<p>Why is this and what is the appropriate solution?!</p>

<p>EDIT:</p>

<p>Please note, I have edited this to make the question less specific and localized, in order for it to gain a better vote.</p>

<p>Rick</p>
