-4
哪一個從下面的代碼1和代碼2是真的,而我們使用return this?如何在jquery插件中使用「return this」?
代碼1:
$.fn.greenify = function() {
$.each(function() {
this.css("color", "green");
return this;
};
};
碼2:
$.fn.greenify = function() {
$.each(function() {
this.css("color", "green");
};
return this;
};
你爲什麼不嘗試一下?或者至少,閱讀[複製此代碼的頁面]的其餘部分(http://learn.jquery.com/plugins/basic-plugin-creation/)? – George
這些都不是工作示例。他們都有語法錯誤。 – meagar
你的代碼中有哪部分你不明白? – SLaks