jQuery - Bug in .html() method?

HI

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?

Hi,

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.

<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Simple table</title>
  </head>
  
  <body>
    <table width="200" border="1">
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
  </body>
</html>

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