jit*_*ter 10
空虚是什么意思.
//cell maycontain new lines,spaces,&npsp;,... but no real text or other element
$("cellselector").text().trim()=="";
Run Code Online (Sandbox Code Playgroud)
要么
//cell has no child elements at all not even text e.g. <td></td>
$("cellselector:empty")
Run Code Online (Sandbox Code Playgroud)
您可以使用带有该$函数的CSS选择器来获取对单元格元素的引用,然后使用该html函数来查看它是否包含任何内容.例如,如果单元格的ID为"foo":
if ($("#foo").html()) {
// The cell has stuff in it
}
else {
// The cell is empty
}
Run Code Online (Sandbox Code Playgroud)