$(item)[0].setAttribute("onclick", "showProductDetail( this)"); function showProductDetail(target) { alert( $(target)[0].getAttribute("id")); } 不确定为什么$(target)[0]要用[0]。