开发者

Return Problems

开发者 https://www.devze.com 2023-03-31 08:50 出处:网络
I do not know English very well; The 开发者_运维百科code below does not return value. return output; undefined..

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

精彩评论

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