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?
https://www.dropbox.com/s/j0lw65bmt2wb9zs/code_31.png
| SitePoint Sponsor |



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?
https://www.dropbox.com/s/j0lw65bmt2wb9zs/code_31.png

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.
More info here: http://stackoverflow.com/questions/9...table-elementsHTML Code:<!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> </td> </tr> </table> </body> </html>
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog
Bookmarks