You are likely to significantly overwork it. Assuming a regular structure with something like this:
<div id="container"> <img /> <div class="info"> <img /> <div class="info"> <img /> <div class="info"> </div>
You could get it all at once ... something like this:
$('#container img').click(function () { $(this).next('div').show(); });
To know exactly how to structure the body of the function in the click handler, we need to see the full markup, but this should get closer, easier.
To cover comments / questions, we use .next('div') , which finds the closest relative after the element referenced by $(this) . For this, images must alternate with information divs. Otherwise, you need some kind of numbering system, which you can return to. I updated my example a bit. Let me know if this helps.
Alternatively, if we are working with a numbering system:
<div id="container"> <img class="group1" /> <img class="group2" /> <img class="group3" /> <div class="group1" /> <div class="group2" /> <div class="group3" /> </div>
With the following JavaScript settings:
$('#container img').click(function () { var $this = $(this); $this.next('div.' + $this.attr('class')).show(); });
This should be very close to you. You will notice that the image and div share a class, which is numbered as a way to link them together.
gddc source share