Hi all, I'm kinda new to these forums, but I was hoping someone could
help me out here..

I've been making plugins in a particular format that suits me really
well. But now I want to be able to run it without using the jquery
selector.
Kind of like you can use: $('p').each(function(){}) ;
I want to be able to do: $.each(array, function(){});

Anyone know how to do this?

Here's the plugin layout that I use. See the second last line for my
attempt to create this functionality.. But this sometimes gives an
error "too much recursion" or it displays all jquery functions
(problably because it's iterating over the jquery object).

/**
 * Plugin testDirectAccessAccess
 */
(function($){
  $.fn.testDirectAccess = function(options){
    var settings = $.extend({}, $.fn.testDirectAccess.defaults,
options);

    return this.each(function(i, elem){
      console.log(printSettings());
    });

    // function
    function printSettings()
    {
      return settings;
    }

  } // end $.fn.testDirectAccess


  /**
   * Plugin defaults
   */
  $.fn.testDirectAccess.defaults = {
    height: '100px',
    width : '200px'
  };

  $.testDirectAccess = function(opts){ $.fn.testDirectAccess
(opts); } // this thingy
})(jQuery);

Reply via email to