[jQuery] only one allowed at a time
I'm creating a photo gallery admin section. I'm allowing the user to
decide which single image they would like to be the gallery image (the
image that displays on the list of galleries page). I am using a green
box to show which image is currently set as the gallery image, and a
red box to show which one's are not selected.
The green box is set as just the image, whereas the red box is a link
to select that image.
The code I currently have seems to turn all the images into red boxes,
but does not turn the currently clicked item green.
Here is what I have:
[code]
$(".main_image").live('click',function(){
var href = $(this).attr('href');
$.get(href);
var $rows = $('#main_table tr');
$rows.each(function(){
var $id = $(this).attr('id');
$id = $id.split("_");
$id = $id[1];
$(this).find('.gallery_image').html('<a class="main_image" href="/
admin/galleries/p_makemain/' + $id + '.php"><img alt="" title="Main"
style="border: 0pt none;" src="/admin/images/redbox.png" /></a>');
});
$(this).parent().html=("<img src='/admin/images/greenbox.png' alt='' /