By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,818 Members | 2,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,818 IT Pros & Developers. It's quick & easy.

document.createElement in IE with TR tag

P: n/a

I have problems with document.createElement() in IE when using TR tags.
Please look at the following very short example:

<table id="test"></table>

<script type="text/javascript">
var MyTable = document.getElementById("test");
var myTR = document.createElement('tr');
var myTD = document.createElement('td');
var myText = document.createTextNode("this is text");


this works fine in Firefox, but IE is very strange. It refuses to
display the created elements. Through further tests I realized, that
only the TR tag is the problem. If this is already in the static HTML
code it works in IE, too.

Further very strange: If I use the developer toolbar for IE and use the
DOM Explorer, it shows me, that all my dynamic generated tags are
there, but they are not displayed.

Has anybody an idea?

Thank you very much!

Best regards,
- Rainer

Oct 18 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
ra***** wrote:
var MyTable = document.getElementById("test");

Get a reference to the tbody element instead of the table element.
When you don't explicitly put one in, IE puts one in for you.
A TR can only be appended to a tbody.

Matt Kruse
Oct 18 '05 #2

P: n/a
this works very fine, thanks a lot!

Oct 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.