Edit this page

up.viewport up.focus(element, [options])
JavaScript function

This feature is experimental. It may be changed or removed in a future version.

Focuses the given element.

Focusing an element will also reveal it, unless { preventScroll: true } is passed.

Parameters

element stringorElementorjQuery

The element to focus.

[options.preventScroll=false] boolean optional

Whether to prevent changes to the acroll position.

[options.force=false] boolean optional

Whether to force focus even if element would otherwise not be a focusable element.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more