[英]How to hide div if table row is empty?
I have a table on my page and I want to display a message telling the user that they need to create content before the table is visible. 我的页面上有一个表格,我想显示一条消息,告诉用户他们需要在表格可见之前创建内容。
Currently when the table is empty the user can still see the table headings (article, date added etc). 当前,当表格为空时,用户仍然可以看到表格标题(文章,添加日期等)。
Using Jquery how would I hide the table and the div containing the table? 使用jQuery,我将如何隐藏表格和包含表格的div?
Do you know what I mean? 你懂我的意思吗?
Like this: 像这样:
$('table:not(:has(ContentSelector))').each(function() {
//This code will run for each empty table.
//`this` will be the <table> element
});
Where ContentSelector
is a selector that matches the content in the table. 其中ContentSelector
是与表中的内容匹配的选择器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.