使用 jQuery,如何检查表格单元格是否为空?

新手上路,请多包涵

使用 jQuery,如何检查表格单元格是否为空?

请帮我。

原文由 Yaswanth 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 320
1 个回答

空虚是什么意思。

 //cell maycontain new lines,spaces,&npsp;,... but no real text or other element
$("cellselector").text().trim()=="";

或者

//cell has no child elements at all not even text e.g. <td></td>
$("cellselector:empty")

原文由 jitter 发布,翻译遵循 CC BY-SA 2.5 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题