SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    725
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question 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?

    https://www.dropbox.com/s/j0lw65bmt2wb9zs/code_31.png

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,359
    Mentioned
    179 Post(s)
    Tagged
    9 Thread(s)
    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.

    HTML 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>&nbsp;</td>
          </tr>
        </table>
      </body>
    </html>
    More info here: http://stackoverflow.com/questions/9...table-elements


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •