Answer the question
In order to leave comments, you need to log in
How to consider empty element even with spaces?
For example, this is in HTML :
<div id="content">
<b><i></i>g</b>
</div>
$('#content *:empty').each(function() {
$(this).remove();
});
Answer the question
In order to leave comments, you need to log in
If a crutch - You can parse the contents
You can remove spaces and check the length of the string. Well, delete if empty
I abandoned direct dynamic manipulations in the DOM with either jQuery or Vanilla JS. In my opinion, this is evil, which leads to complete and total unpredictability of the application's behavior and the formation of an extensive field for unmanaged bugs.
Our path is React.JS, when interfaces are generated from data, and you only change the data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question