Possible Duplicate:
Inserting an element
How to do insert After() in JavaScript without using a library?
I have this little bit of javascript in a project which adds a chat window after the body of the page, I'd like to change it so that it adds the chat window AFTER my specified div "myPublisherDiv". I think this is pretty simple, any ideas? Thanks in advance!
var div = document.createElement('div');
div.setAttribute('id', 'stream' + streams[i].streamId);
document.body.appendChild(div);
getElementById: developer.mozilla.org/en/DOM/document.getElementByIddiv.setAttribute('id', 'stream' + streams[i].streamId);can be writtendiv.id = 'stream' + streams[i].streamId;;idis a reflected property on elements and is universally supported.