Fork me on GitHub

article

Javascript, IE and Generating Tables

July 9, 2006 | Web Design & Development

It seems that when generating tables in JavaScript IE requires that you generate a tBody with that table or else nothing at all shows up. See, when loading a page browsers will generate a tBody automatically and slip it into the dom. That’s why even when you don’t have one in your page you still have to dig through them when traversing the DOM.

The only catch is that other browsers do this for generated tables as well. IE doesn’t like to do it on the fly, hence, a generated table without a tBody is a no show.

I guess I must have skimmed over one or two things while learning Javascript. I have a bad habit of stopping reading when I "feel" like I can do what I’m setting out to do at that moment. This time it bit me in the ass for a few hours.

So, remember kids, when generating tables always generate a tbody…

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  • Hey! Nothing wrong with stopping when you feel like you get it already! …

    </sarcasm>

    Joey Brooks, August 14, 2006 3:21 am | permalink

Comments are closed