Hi Wizz,
yeah I create the elements with new Element but it's inside a function; so i
call the function which builds the dom snipped (it's passed some stuff it
needs)
I guess I could make it return an object with more than one dom object so I
have access to the image as it already returns the final snippet
I was just wondering if the nav methods were meant to work on detached
nodes.
Gareth
On 12/22/07, Wizz <[EMAIL PROTECTED]> wrote:
>
>
> How do create this snippet of code? Cause if you just inserted a
> string in the div with innerHTML, I can understand why it isn't
> working.
>
> It's better if you just create the elements bfore you insert them into
> the div.
>
> var container = new Element('div');
> var image = new Element('img');
> container.insert(image);
>
> that way you already have a refrence to the element you need to call.
>
> img.writeAttribute('src', 'path/image.gif');
>
> Greetz,
>
> Wizz
>
> On 21 dec, 04:51, "Gareth Evans" <[EMAIL PROTECTED]> wrote:
> > Hey guys
> >
> > I have a bunch of element fragments (ie this might be a div, with
> children
> > of an image, another div) etc which aren't attached to the document
> yet..
> > and can't seem to call the dom manipulation methods on them:
> >
> > down('img.icon') returns undefined but if I look at the innerHTML of the
> > element, there is clearly an image there with that class.
> >
> > Is this is a known limitation and what options do I have?
> >
> > Everything is encapsulated in functions, so I know I need an image tag
> > there, but I dont know the source until the callee performs some further
> > ifs, however I need the element for this ifs, it's sorta a catch 22.. so
> I
> > generate the dom fragment and then want to set the image src later-
> except I
> > cant get a reference until its attached...
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---