getTarget

Commons
stable

Resolves a CSS selector string or a Vue component instance / HTMLElement reference to the underlying HTMLElement. Returns null when no match is found in the document.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

el
required
ComponentPublicInstance | HTMLElement | string | undefined
A CSS selector string, a Vue component instance, or an HTMLElement. When a string is provided, document.querySelector is used to locate the element.

API

Return value

The value returned by this util.

The resolved HTMLElement, or null when the selector yields no result or the input is undefined.

Usage

Examples

Ready-to-paste usage snippets.

Resolve by selector and by ref

typescript