Is it possible to focus on a
using JavaScript focus() function?

前端 未结 8 1852
说谎
说谎 2020-11-22 14:21

Is it possible to focus on a

using JavaScript focus() function?

I have a

tag

8条回答
  •  甜味超标
    2020-11-22 14:46

    You can use tabindex

    The tabindex value can allow for some interesting behaviour.

    • If given a value of "-1", the element can't be tabbed to but focus can be given to the element programmatically (using element.focus()).
    • If given a value of 0, the element can be focused via the keyboard and falls into the tabbing flow of the document. Values greater than 0 create a priority level with 1 being the most important.

提交回复
热议问题