javascript - How to use jquery to remove <div> in a table? -


I am trying to remove some lines surrounded by a div, but this does not work, why?

  $ (function () {$ ("# div1"). Blank ();}); & Lt; Table ID = "TBL" limit = "1px" & gt; & Lt; Thead & gt; ... & lt; / Thead & gt; & Lt; Tbody id = "tblBody" & gt; & Lt; Div id = "div1" & gt; & Lt; Tr id = "tr1" & gt; & Lt; TD & gt; Line 1 & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Line 2 & lt; / Td> & Lt; / TR & gt; & Lt; / Div & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;  

Because & lt; There is no such thing as rows surrounded by div & gt; . & lt; Div & gt; inside & lt; Tbody & gt; is invalid for putting, so the browser & lt; Div & gt; Trying to fix his mistake by kicking. ; By putting it somewhere else in the document tree outside the table, you are not expecting it, and make sure that any & lt; Tr & gt; So when you empty it, there is no content to lose it.

This is what many & lt; Tbody & gt; for s.


Comments