這個問題大家看看吧
init:?function(selector)?{
this.selector?=?selector;
return?this;
},
為什么要return?this呢?
這是jquery源碼里的問題var $$ = ajQuery = function(selector) {
? ? return new ajQuery.fn.init(selector);
}
ajQuery.fn = ajQuery.prototype = {
init:?
}
init:?function(selector)?{
this.selector?=?selector;
return?this;
},
為什么要return?this呢?
這是jquery源碼里的問題var $$ = ajQuery = function(selector) {
? ? return new ajQuery.fn.init(selector);
}
ajQuery.fn = ajQuery.prototype = {
init:?
}
2016-08-09
舉報
2016-08-16
return this;可以讓JQuery形成一個鏈式的使用結構。在jQuery對象中,this指向本身的jQuery對象。
2018-11-12
w剛開始看也是這個疑問