Default html form focus without JavaScript

后端 未结 5 2157
傲寒
傲寒 2020-12-01 03:48

Is it possible to set the default input focus on an HTML form without using JavaScript, for example:


  
Input 1:
5条回答
  •  -上瘾入骨i
    2020-12-01 04:48

    You might be able to use the tabindex attribute and use the lowest value on the default textbox though. Check here for browser support:

    http://reference.sitepoint.com/html/object/tabindex#compatibilitysection

    The site suggests that

    (in almost all other cases—namely form controls and links—the tabindex has excellent support)

提交回复
热议问题