Discussion:
Adding an element
(too old to reply)
frameexpert
2006-10-20 13:12:08 UTC
Permalink
Hello all,

I have an element that I want to add to another element. Here is the
before example:

<Title>This is the title element all by itself</Title>

I want to add an element like this:

<Title><a name="xyz"/>This is the title element all by itself</Title>

If I use appendChild, it looks like this:

<Title>This is the title element all by itself<a name="xyz"/></Title>

which is not what I want. How do I get the <a name> element directly
after the opening <Title> tag? Thank you very much.

Rick Quatro
***@gmail.com
frameexpert
2006-10-20 13:32:30 UTC
Permalink
I figured it out. Using this works:

oTitle.insertBefore(oAname, oTitle.firstChild);

Thanks,
Rick
Post by frameexpert
Hello all,
I have an element that I want to add to another element. Here is the
<Title>This is the title element all by itself</Title>
<Title><a name="xyz"/>This is the title element all by itself</Title>
<Title>This is the title element all by itself<a name="xyz"/></Title>
which is not what I want. How do I get the <a name> element directly
after the opening <Title> tag? Thank you very much.
Rick Quatro
Loading...