[thelist] Simple DOM Question

ben morrison morrison.ben at gmail.com
Wed Oct 18 10:19:35 CDT 2006

On 18/10/06, Tim Palac <tymartist at hotmail.com> wrote:
> I have a question so simple you'll probably smack me for asking, but if I'm creating a link using DOM / Javascript how do I append text to the link?  I was trying to use appendChild but that was only adding text after the link, and not as the link text itself.  I even used the DOM Inspector and after doing that, the structure looked the same as in a page where the text was part of the link.  Thanks for your help!

You need to use createTextNode:

function addTextNode()
var newtext = document.createTextNode(" Some text added dynamically. ");
var para = document.getElementById("p1");



More information about the thelist mailing list