Skip to content
0

katanakit-js / useFocusElement

Function: useFocusElement() ​

ts
function useFocusElement(target): boolean;

Defined in: src/infrastructure/viewport/viewport.service.ts:247

Focuses an element.

Parameters ​

ParameterTypeDescription
targetstring | HTMLElementAn HTMLElement or a CSS selector string.

Returns ​

boolean

true if the element was found and focused.

Example ​

ts
useFocusElement("#search-input");

Released under the MIT License.