HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

focus

Description

The focus of HTMLOrSVGElement for JS moves the focus to the element.

If the element is a navigable container, moves the focus to its content navigable instead.

By default, this method also scrolls the element into view. Providing the preventScroll option and setting it to true prevents this behavior.

Syntax

element.focus([options])
element.focus([ { preventScroll: true } ])

Parameters

options

Allows setting preventScroll.

preventScroll

Prevents scrolling the element into view.

Examples

1 · void

2 · options · preventScroll · false

3 · options · preventScroll · true