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

Line 32: Line 32:
 
     }
 
     }
 
</script>
 
</script>
 
+
window.onload = function removeEmpty()
 +
{
 +
var paragraphs = document.getElementsByTagName("p");
 +
for (var i = 0, len = paragraphs.length; i < len; i++) {
 +
    var elem = paragraphs[i];
 +
    if (elem.innerHTML == '<br></br>') {
 +
        elem.parentNode.removeChild(elem);
 +
        i--;
 +
        len--;
 +
    }
 +
}
 +
}
 
<script>
 
<script>
$( document ).ready(function() {
+
 
$("p").each(function(){
+
  if ($.trim($(this).text()) == ""){
+
    $this.remove();
+
  }
+
});
+
});
+
 
</script>
 
</script>
  

Revision as of 07:52, 10 September 2015

window.onload = function removeEmpty() { var paragraphs = document.getElementsByTagName("p"); for (var i = 0, len = paragraphs.length; i < len; i++) { var elem = paragraphs[i]; if (elem.innerHTML == '

') { elem.parentNode.removeChild(elem); i--; len--; } } }