Is there a jQuery selector to get all elements that can get focus?

前端 未结 8 609
故里飘歌
故里飘歌 2020-12-01 15:54

This answer tells which HTML elements can receive focus. Is there a jQuery selector that matches exactly these elements?

For now I\'m just using $(\'input,sele

8条回答
  •  我在风中等你
    2020-12-01 16:34

    Instead of getting a list of focusable elements, you may want to try setting up a focus handler at the body element that captures focus events.

    $(document.body).on("focus", "*", function(e) {
        //Scroll to e.target
    });
    

提交回复
热议问题