2012-09-06 37 views

回答

1

格的對象,你可以通過檢查這個喜歡

使這個簡單的做
$(".nailthumb-container").click(function() { 
    alert($(this).attr("id")); 
    //alert(this.id); //you can also try this 
    alert('Hii'); 
}); 

,如果你想得到誰觸發這個事件,你可以得到像這裏放置e的目標,它將捕獲事件對象。

$(".nailthumb-container").click(function (e) { 
    alert(e.target.id); 
    alert('Hii'); 
}); 
1

好,您可以在使用this

this會給你,你已經點擊

$(".nailthumb-container").click(function() { 
    alert($(this).attr('id')); 
});​ 

Demo