I have a question about streamlining my jquery code. I have a list of images and each has a unique id and the click event displays the larger image and its info. Is there a way to do this with a loop similar to php's foreach loop?
$(function() {
$('img#cl_1').click(function() {
$('div#left').html('display image').slideDown('fast');
$('div#right').html('display image info').slideDown('fast');
});
$('img#cl_2').click(function() {
$('div#left').html('display image').slideDown('fast');
$('div#right').html('display image info').slideDown('fast');
});
$('img#cl_3').click(function() {
$('div#left').html('display image').slideDown('fast');
$('div#right').html('display image info').slideDown('fast');
});
$('img#cl_4').click(function() {
$('div#left').html('display image').slideDown('fast');
$('div#right').html('display image info').slideDown('fast');
});
/*so on and so forth*/
});