up.element up.element.first([parent], selector)
JavaScript function

This feature has been deprecated. Use up.element.get() instead.

Load unpoly-migrate.js to polyfill deprecated features.

Returns the first descendant element matching the given selector.


Parameters

[parent=document]
optional

The parent element whose descendants to search.

If omitted, all elements in the document will be searched.

Type: Element
selector
required

The CSS selector to match.

Type: string

Return value

The first element matching the selector.

Returns null or undefined if no element macthes.

Type: Element | undefined | null