javascript - table elements not showing in IE -


i'm new javascript , i'm having strange issue. javascript generated table elements not working in ie, worked fine in every other browser i've tried. managed isolate issue adding child elements in js:

var table = document.createelement("table"); var tabler = document.createelement("tr"); var tab = document.createelement("td"); var node = document.createtextnode('test'); textdiv.appendchild(table); table.appendchild(tabler); tabler.appendchild(tab); tab.appendchild(node); 

the above creates table single text element in chrome, in ie blank.

i did experimenting , found code:

var table = document.createelement("table"); var tabler = document.createelement("tr"); var tab = document.createelement("td"); var node = document.createtextnode('test'); textdiv.appendchild(table.appendchild(tabler.appendchild(tab.appendchild(node)))); 

does work in both ie , chrome, table being formatted align center, whereas first code aligned left (css has body aligned center).

what's going on here?

i believe issue don't have <tbody> in table. see similar post longer explanation:

can't dynamically add rows <table> in ie?


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -