Remove <p> & nbsp; </p> with jquery if no value
how to hide attributes if you discover this <p> </p>
My problem is when my client inserts data (example table) with ckeditor, when I see the source code, ckeditor will add this <p> </p>after the table code. I know how to remove this source code guide (open source and delete), but not with my client!
+3
4 answers
Orignal answer: How to remove empty p tags using jQuery?
Try
$('p').each(function() {
var $this = $(this);
if($this.html().replace(/\s| /g, '').length == 0)
$this.remove(); });
here is the working code: http://jsfiddle.net/ambiguous/7L4WZ/
+8