If a span doesn't have text remove it or don't show it
Dear all,
<span class="myclass" style="color: red;">I can have text or I can be empty</span>
I want to show this span if it contains text, otherwhise I want to show nothing ..
How can I do it?
I was trying this:
-
$(".myclass:contains('')").each( function () {
$(".myclass").remove();
});
but it does not work, it removes the span always.
Thanks in advance!!