Question: My *html markup* can look as following:

```
<h2></h2> <!-- empty -->
<h2>text</h2> <!-- not empty -->
<h2><p>text</p><h2> <!-- not empty -->
<h2><p></p>/<h2> <!-- empty -->
<h2><p><span></span></p></h2> <!-- empty -->

```

Is there a way to check if the `h2`-element itself or the `h2`-element with *n-children nodes* contains any **html**-content.

So far I have tried

```
 if ( $('h2').html() !== '' ) ...
 if ( $('h2 *').html() !== '' ) ...
 if ( $('h2').html().length ) ...

```

**EDIT:** Just to clarify, I want this code working for every *h2*. The number of children nodes/nested children nodes within the *h2*-node is unknown.

Answer: 
What about `:empty`?

```
if ($('h2').is(':empty')) {...}

```
Use jQuery's `.text()` instead of `.html()`:

```
 if ( $('h2').text().length )

```