开发者

Return Problems

I do not know English very well; The 开发者_运维百科code below does not return value. return output; undefined..

(function($) {
    $.fn.mubsisUpload = function(options){
        var defaults = {            
            Tabs: false,
        }           
        var options = $.extend(defaults, options);
        $.each(options.Tabs,function(i, name) {
            return name.divId
        });
    }
})(jQuery);

$(function() {
    var event = $().mubsisUpload({
        Tabs : [
            {divId  : 'j123j4j3j212emas'},
            {divId  : 'dqwd123432dd8asx'}
               ]
    });     
    alert(event)
});


The return there returns from the anonymous function inside $.each(). It doesn't return from the outer function. You probably want something like this:

var returnValue = [];
$.each(options.Tabs,function(i, name) {
    returnValue.push( name.divId );
});
return returnValue;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜