does this solve your problem ?
http://mootools.net/docs/core/Element/Element#Element:adopt

On Fri, Oct 23, 2009 at 6:48 PM, TheIvIaxx <[email protected]> wrote:

>
> so i start with a JSON string of information, from this JSON object i
> construct links by:
>
> var links = [];
> var link = new Element('a', {'href':...})
> links.push(link);
>
> lets says i have 3 links in the links array.  Now i need to join these
> links with a comma and put them into a DIV that results in the
> following html:
>
> <div>
>    <a href="...">...</a>,
>    <a href="...">...</a>,
>    <a href="...">...</a>
> </div>
>
> i could just loop through these and kind of reconstruct the html from
> the elements, but i was wondering if there was a fancy way to do it.
>
> sorry for the use of "link" above, hope its not confusing.
>
> On Oct 22, 11:22 pm, csuwldcat <[email protected]> wrote:
> > here it is in MooShell:http://mooshell.net/MkrV7/
> >
> > On Oct 22, 11:17 pm, csuwldcat <[email protected]> wrote:
> >
> >
> >
> > > If you just want the hrefs in an array do what Aaron said, if you want
> > > some span on a page for instance to be populated with links having
> > > commas between them then do something like i suggested, again i havent
> > > tested that...
> >
> > > On Oct 22, 11:13 pm, csuwldcat <[email protected]> wrote:
> >
> > > > $$('a').each(function(e, i, a){ yourElement.grab(e).appendText((i <
> > > > a.length -1) ? ',' : ''); });
> >
> > > > I didnt test that yet, but try it out.
> >
> > > > On Oct 22, 10:24 pm, "Steve Onnis" <[email protected]> wrote:
> >
> > > > > getElements("a").toString()
> >
> > > > > All yo uwill get though is "object,object,object"
> >
> > > > > What are you trying to do with them?
> >
> > > > > -----Original Message-----
> > > > > From: TheIvIaxx [mailto:[email protected]]
> > > > > Sent: Friday, 23 October 2009 4:07 PM
> > > > > To: MooTools Users
> > > > > Subject: [Moo] join a list of elements
> >
> > > > > If i have an array of 'a' Elements and i would like to join them
> with
> > > > > a ',' resulting in a list of comma separated links on a page.  Is
> > > > > there a quick way to do this in mootools?
> >
> > > > > Thanks
>



-- 
http://tbela99.blogspot.com/

fax : (+33) 08 26 51 94 51

Reply via email to