jQuery.fn.newTarget = function() {
return this.each(function() {
if (this.host != window.location.host) { $(this).attr('target', '_new'); } });};
请问各位大侠 为什么each前面用this而不用$(this) each不是jquery函数吗 按说应该用jqeury对象调用才对呀
return this.each(function() {
if (this.host != window.location.host) { $(this).attr('target', '_new'); } });};
请问各位大侠 为什么each前面用this而不用$(this) each不是jquery函数吗 按说应该用jqeury对象调用才对呀
$(json).each(function(){
...this
})
这里的this代表 的就是json
alert(this);
}a(); // object Windowa.call(1); // 1jquery中将this指向两元素本身