Javascript examples for jQuery:Select Dropdown
Remove <ul> elements if they do not have <li> elements
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <style id="compiled-css" type="text/css"> ul{border: 1px solid #ff0000;} </style> <script type="text/javascript"> $(window).load(function(){//from w w w . j a v a2 s . c om $("ul:empty").hide() }); </script> </head> <body> <ul></ul> <ul> <li> aa </li> <li> bb </li> <li> cc </li> </ul> </body> </html>