這句話總是對的嗎?
$("p").click(function(event) {
alert(event.currentTarget === this);
});
是一種比其他方法更受歡迎的方法嗎?我喜歡用$(this)
而不是event.currentTarget
,但是在某些情況下可以做得更好嗎?哪個更好?絕對一樣嗎?
而另一個細微差別 - 當檢查螢火蟲console.log(this)
和console.log($(this))
給我完全相同的元素。如果它們是相同的 - 有什麼不同? (因爲我知道我可以寫這個$(this).css('color','white')
但不能寫入this.css('color','white')
:(分鐘太晚了。 – 2011-12-22 12:49:35