$(".userImg").each(function(){ $(this).click(function(){ var imgid = $(this).attr("id"); alert(imgid ); }) });
//获取image src路径
$(".userImg").click(function(){
var imgsrc = $(this).attr("src");
alert(imgsrc);
});
//获取Id $("this")里面的 双引号“” 去掉
$(".userImg").click(function(){
var imageId= $(this).attr("id");
alert(imageId);
});