I have a dynamically generated thumbnail images on the left side of my popup and on click of the image i want that image to be displayed on the right hand side.
I am using the below code:
$.ajax({
type: "POST",
url: "/buildyourholiday/placeimages",
data: "srcid="+cityid,
success: function(data){
var objsrc = jQuery.parseJSON(data);
var src="";
$(".photoright").append().empty();
$.each(objsrc, function(index, obsrc){
src += '<ul>'+
'<li><a href="#"><img id="citythumb" onclick="sliderimage(this)" src="/images/city/thumbs/'+obsrc.img_filename+'" width="100" height="100"></a></li>'+
'</ul>';
});
$(".photoright").append(src);
function sliderimage(image)
{
alert("sdf");
alert(image);
}
}
});
When i firebug it i get sliderimage is not a function. When i use the onclick event after append i get only the first image, but there are multiple images. I want the onclick to work on the click of any image. How to go about it?
Thanks,