Problemas de devolución

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

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

preguntado el 27 de agosto de 11 a las 14:08

What do you think it should return? Note that the only return statement you have is in the anonymous function supplied as the callback to each. You don't have a return statement in the plugin function at all, but it's hard to tell you how to fix it if we don't know what you expect it to return. Normally I'd expect it to return the same jQuery or nothing. -

Mert... ACCEPT the answer if you like it -

1 Respuestas

Al 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;

Respondido 27 ago 11, 18:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.