When a user clicks on a div tag, I want to store the corresponding id value in var current, so that it can later be used to iterate to that index, and so that div can be shown and hidden.
html
<div class="gallerypreview" id="1"></div>
<div class="gallerypreview" id="2"></div>
<div class="gallerypreview" id="3"></div>
js
var images = new Array();
$(document).ready( function(){
$('.gallerypreview').each(function() {
    images.push($(this).attr("id"));
});
$('.gallerypreview').click(function() {
var current = $('.gallerypreview').index(this);
});
});
How would I go about retrieving the div id from this clicked div? I can get the index number fine, but I cannot find the value of the index using any functions that utilizes the index #.
 
     
     
     
     
    