On Feb 15, 2:29 am, ohneworte <[EMAIL PROTECTED]> wrote:
> My desired HTML:
>
> <span>
> <h1>Lorem ipsum</h1>
> Some Text or more HTML-Stuff
> <span id="myElement"></span>
> </span>
>
> Any ideas?
Well, I'll make that outer SPAN into a DIV for this example (SPAN is
an inline element, H1 is a block-level element, and inline elements
can't contain block-level elements):
var myElement = $('myElement');
var div = new Element('div').update(/* whatever contents you want */);
myElement.replace(div);
div.insert({ bottom: myElement });
The basic idea is that you can build your HTML shell, insert it into
the DOM at myElement's location, then insert myElement at the bottom
of the shell. You could do this with Element#wrap, but in this case
it's not the easiest solution.
Cheers,
Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---