jQuery - Bug in .html() method?


Please take a look at the source here… http://jsbin.com/edozum/2/edit

Can someone please tell me why is the jquery .html() method is adding tbody tag when getting the html from the DIV?


It’s not a jQuery thing, it’s a browser/HTML thing.
The <tbody> tag is not explicitly required in your markup, but it will be always included in the DOM.
To see what I mean, copy this file to your PC, run it, then examine the table using Chrome’s dev tools (or similar). You will see a <tbody> tag there, too.

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Simple table</title>
    <table width="200" border="1">

More info here: http://stackoverflow.com/questions/938083/why-do-browsers-insert-tbody-element-into-table-elements