$(".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);
});
