var city =$("#city");?? ??? ??? ?//這個city是dom還是jq
?? ??? ??? ??? ??? ?if(city instanceof jQuery)
?? ??? ??? ??? ??? ??? ?alert(11);
?? ??? ??? ??? ??? ?else
?? ??? ??? ??? ??? ??? ?alert(this.tagName);
總結:
1 如果是一個節點的某個事件的綁定函數中,this是一個dom對象;
$("#button").click(function(){
這里的this是dom對象;
});
2 如果是通過jquery選擇器 ,得到的對象,是一個jquery對象
var x =$("div")就是一個jQuery對象.