return 还是 不return

jQuery.fn.functiona = function() {
//return this.each(function() { **** }
jQuery(this).css('backgroundColor','red');
}

jQuery(document).ready(function() {
jQuery('#user-login-form').functiona();
});

 

jQuery.fn.functiona = function() {
//return this.each(function() { **** }
return jQuery(this).css('backgroundColor','red');
}

jQuery(document).ready(function() {
jQuery('#user-login-form').functiona();
});

 

--- 奇怪的是,有没有return都可以,请问这是为什么?

--碰到问题怎么办?第一,是去问,问不到,不好问,不要忘了一件事,就是去试验,这样自己得出结论更加可靠更加印象深刻。丰衣足食自己动手。

posted @ 2016-08-31 16:46  qqisnow2021  阅读(141)  评论(0编辑  收藏  举报