Difference between revisions of "Team:Czech Republic/Template:Scripts"

Line 34: Line 34:
  
 
<script>
 
<script>
$('p').each(function(index, item) {
+
window.onload = function removeEmpty()
     if($.trim($(item).text()) === "") {
+
{
         $(item).remove();
+
var paragraphs = document.getElementsByTagName("p");
 +
for (var i = 0, len = paragraphs.length; i < len; i++) {
 +
    var elem = paragraphs[i];
 +
     if (elem.childElementCount == 0 && elem.textContent.trim() == '') {
 +
         elem.parentNode.removeChild(elem);
 +
        i--;
 +
        len--;
 
     }
 
     }
});
+
}
 +
}
 
</script>
 
</script>
  

Revision as of 16:29, 9 September 2015