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;
精彩评论