---
name: "up.element.toSelector"
area: "API"
kind: "JavaScript function"
parent: "up.element module"
visibility: "deprecated"
url: "https://unpoly.com/api/up.element.toSelector"
---
<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.toSelector(element)

**This feature has been deprecated**. Use [`up.fragment.toTarget()`](https://unpoly.com/api/up.fragment.toTarget.md) instead.

Load [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md) to polyfill deprecated features.

Returns a CSS selector that matches the given element as good as possible.

Alias for [`up.fragment.toTarget()`](https://unpoly.com/api/up.fragment.toTarget.md).

---

## Parameters {#parameters}

### element {#element}

(required)

The element for which to create a selector.

Type: string | [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) | [jQuery](https://learn.jquery.com/using-jquery-core/jquery-object/)

