Detect empty html elements TinyMCE lefts behind
on 11-Jan-2010 | Comments ( 2 ) Tags: Evolution, Revolution
If your website has lots of empty tags that editors don't know how to remove, you can use the following code to highlight them.
Just in case you want to do it on a live website I also added an IP address test so regular users don't see the highlighted tags.
Make sure you add your IP address in the code. Your website will need jQuery in order for the script to work.
$.getJSON("http://jsonip.appspot.com?callback=?",function(data){
if(data.ip == 'YOUR IP ADDRESS'){
$('p,em,b,strong,span,h1,h2,h3,h4,h5').each(function() {
if (jQuery.trim ($(this).text()) == ""){
$(this).css({'border':'solid 1px red'});
}
});
}
});
Note: The code will also highlight tags that have only html in them.

Write a comment
Posts: 2
Reply #2 on : Mon February 08, 2010, 21:51:34
Posts: 2
Reply #1 on : Fri March 25, 2011, 04:50:34