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

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
 
Andreas Wettainen
Posts: 2
Comment
NICE!!
Reply #2 on : Mon February 08, 2010, 20:51:34
I love your site! Awesome tip!!
someone
Posts: 2
Comment
Re: Detect empty html elements TinyMCE lefts behind
Reply #1 on : Fri March 25, 2011, 03:50:34
This is really awesome.
But where must i paste the code?

Quick modx Evolution Tags

  • cached [[snippet]] or uncached [!snippet!]
  • {{chunk}}
  • [+placeholder+]
  • [*resourceField/TV*]
  • [^timing^]
  • [~link~]

Quick modx Revolution Tags

  • [[snippet]]
  • [[$chunk]]
  • [[+placeholder]]
  • [[*resourceField/TV]]
  • [[~link]]
  • [^timing^]
  • [[++systemSetting]]
  • [[%languageStringKey]]
  • all tags can be called un-cached like: [[! snippet]]

Timing Tags (Evo and Revo)

  • [^qt^] - Query time
  • [^q^] - Query count
  • [^p^] - Parse time
  • [^t^] - Total time
  • [^s^] - Source
© modxRULES! 2009-2014