天天看點

this 和 $(this) 有什麼差別?this 和 $(this) 有什麼差別?

this 和 $(this) 有什麼差別?

舉個例子:

var array = [1,2];
$(array).each(function() {
    alert($(this)); //[object Object]  對$(array)操作
    alert($(array));
    alert(this); // 1 , 2              對array周遊出來的 每一個對象操作
})



$(array)等價于$(this)  

this 是指目前周遊的對象。