GOT IT!

First the code that worked...

jQuery.fn.coopforms =  function(){
   var myForms = new Array();
   jQuery('form').each(function(){
       if(jQuery(this).attr("coop:manage")=="true") {
           myForms[myForms.length] = this;
           coopformlist = jQuery.ListAppend(coopformlist,this.id);
       }
   })
   return jQuery(myForms);
}

Now the explaination. You just pass the array collection into a jQuery() item and it translates them into jQuery objects so the output of this function can now be chained!

John Farrar

P.S.
The bug should still be fixed or enhanced. But this works for now! I added this information to the ticket.

Mike Alsup wrote:

John,

Regarding arrays, you can simply wrap an array of elements in a jQuery object:

var arr = [];

// some code that pushes elements into arr

$(arr).each(function() ....

Mike

but that doesn't return a collection of forms where the condition is true... and if you manually create an array that doesn't work with the jQuery each.


Reply via email to