0

I've noticed that when I create a table with rows and stuff, chrome likes to automatically add a tbody element in between. Firefox also creates it but doesn't put the content inside it so it just kinda floats there.

Anyways, I'm dynamically adding rows to a table via js. Should I respect the browsers affinity for tbody and make the script add the children there instead of the table element?

user81993
  • 6,167
  • 6
  • 32
  • 64
  • *"so it just kinda floats there"* - Huh? What floats, the content or the tbody? Where does it float? – nnnnnn May 16 '16 at 04:05
  • 1
    Possible duplicate of [Add table row in jQuery](http://stackoverflow.com/questions/171027/add-table-row-in-jquery) – Nikhilesh K V May 16 '16 at 04:16

1 Answers1

0

Browsers automatically add tbody element to table if you didn't do it explicitly. A table may have single thead, single tfoot, and many tbody elements. Generally, a problem may occur when you use table>tr or (if you add several tbody tags explicitly) table tr:nth-child() selector.

Alex Kudryashev
  • 9,120
  • 3
  • 27
  • 36