Javascript examples for jQuery Method and Property:remove
Remove empty tags in a HTML doc with jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <style id="compiled-css" type="text/css"> p {background:red; display:block; height:10px;} </style> <script type="text/javascript"> $(window).load(function(){// w w w . j a v a 2 s. c om $('p').filter(function(){return $(this).text().trim().length==0}).remove(); }); </script> </head> <body> <p> </p> </body> </html>