Hi, Unfortunetly, I had to realize that my approach does not work in any every case.
var new_element = new Element('div').update('<tr></tr>'); fails. tr Tag is not added to div I think update function checks if tr elements are allowed inside of div elements, cause new Element('tbody').update('<tr></tr>'); works as aspected. Does anybody if there exists a tag which can be updated with any html code? Thanks a lot in advance. -- Volker On 5 Nov., 10:58, vhochstein <vhochst...@googlemail.com> wrote: > Hi > > Thanks a lot for your help. > > I slightly changed it: > var new_element = new Element('div').update(html); > new_element = new_element.firstDescendant(); > Element.replace(old_element, new_element); > > -- > Volker > > On 4 Nov., 23:31, "T.J. Crowder" <t...@crowdersoftware.com> wrote: > > > > > > > > > On Nov 4, 5:30 pm, vhochstein <vhochst...@googlemail.com> wrote: > > > > Hi, > > > > if I call old_element = Element.replace(element, 'html code for new > > > element') > > > I get the old_element in response. > > > > How may I get the new_element node if it does nt have an id attribute? > > > > Thanks a lot in advance. > > > > -- > > > Volker > > > Well, you could find it through the hierarchy or some such, but > > probably the easiest thing is to get a reference to it *before* you > > replace it: > > > var new_element = new Element('tagName').update('contents'); > > Element.replace(old_element, new_element); > > > Live example:http://jsbin.com/uwibuh > > > HTH, > > -- > > T.J. Crowder > > Independent Software Engineer > > tj / crowder software / com > > www / crowder software / com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.