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

前端 未结 8 599
故里飘歌
故里飘歌 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:30

    Another simple, but complete, jQuery selector could be this one:

    $('a[href], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]')
    .not('[tabindex=-1], [disabled], :hidden')
    

提交回复
热议问题