The :empty selector selects empty elements.
An empty element is an element without child elements or text.
$(":empty")
Select all empty elements:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(":empty").css("background-color", "yellow"); });/* www. jav a 2s. c om*/ </script> </head> <body> <h1>Welcome to My Web Page</h1> <table border="1"> <tr> <th>Company</th> <th></th> <th>Country</th> </tr> <tr> <td>CSS</td> <td>Java</td> <td></td> </tr> <tr> <td>A</td> <td></td> <td>Sweden</td> </tr> <tr> <td>Javascript</td> <td>Python</td> <td>Mexico</td> </tr> <tr> <td>C++</td> <td></td> <td>XYZ</td> </tr> <tr> <td></td> <td></td> <td>UK</td> </tr> <tr> <td>C</td> <td>HTML</td> <td>Germany</td> </tr> <tr> <td>HTML5</td> <td>Yes</td> <td>Canada</td> </tr> <tr> <td>M</td> <td>Name</td> <td>Italy</td> </tr> <tr> <td>North/South</td> <td>Var</td> <td>UK</td> </tr> </table> </body> </html>