开发者

How to hide div if table row is empty?

开发者 https://www.devze.com 2022-12-20 17:39 出处:网络
I have a table on my page and I wantto disp开发者_如何学Pythonlay a message telling the user that they need to create content before the table is visible.

I have a table on my page and I want to disp开发者_如何学Pythonlay 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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消