You're "switchContent()" plugin needs to do an ".each()" on each
element

Look at Mike's BlockUI plugin code

http://malsup.com/jquery/block/jquery.blockUI.js?v2.20

like

// plugin method for unblocking element content
$.fn.unblock = function(opts) {
    return this.each(function() {
        remove(this, opts);   // "this" is each object
    });
};



On Jun 3, 1:45 pm, "benhalde...@googlemail.com"
<benhalde...@googlemail.com> wrote:
> Hi guys,
>
> This is my first post, I've searched for a solution and thought I'd
> throw this up here.
>
> I am passing two elements to a custom function like so:
>      $('div#targets, div#triggers').switchContent();
>
> Inside the function I want to access these elements individually so
> that I can operate on them.
> I thought I could use this[0] and this[1] so that this[0] would be
> '#targets' and this[1] would be '#triggers'.
> But as you'd expect these give me the element in relation to their
> order in the DOM not in relation to their order in the jQuery
> selector.
>
> Any ideas what the syntax is for getting each element out by its order
> in the selector?
>
> many thanks
> Ben Haldenby

Reply via email to