How can I get the ID of any element clicked within the $(document) in jQuery/js?
$(document).click(function(e){
alert(e.target);
});
That alerts [Object HTMLDivElement], is there another variable with the开发者_运维问答 ID of the object?
alert($(e.target).attr("id"));
or
alert(e.target.id);
精彩评论