---
name: "up.element.isEmpty"
area: "API"
kind: "JavaScript function"
parent: "up.element module"
visibility: "experimental"
url: "https://unpoly.com/api/up.element.isEmpty"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.element module](https://unpoly.com/api/up.element.md)</nav>

# up.element.isEmpty(element)

**This feature is experimental**. Please [share](https://github.com/unpoly/unpoly/discussions) your experiences so we know what to keep or change.

Returns whether the given element has no content.

An element is considered to have content if it has either child elements or non-whitespace text.

<nav aria-label="Contents">

#### Contents

- [Examples](#examples)
- [Parameters](#parameters)
- [Return value](#return-value)

</nav>

## Examples {#examples}

These `<div>` elements are all considered empty:

```html
<div></div>

<div>   </div>

<div attr="text"></div>
```

These `<div>` elements are _not_ considered empty:

```html
<div>
  Text
</div>

<div>
  <span>Text</span>
</div>

<div>
  <span></span>
</div>
```

---

## Parameters {#parameters}

### element {#element}

(required)

Type: [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element)

---

## Return value {#return-value}

Whether the given element is empty.

Type: boolean

