How do I make a field autofocus?

后端 未结 3 1697
挽巷
挽巷 2021-01-12 15:18

I need this field to be focused when the user opens the page. I don\'t know if it changes anything but it\'s inside a modal window I load from a PHP file.

I

3条回答
  •  -上瘾入骨i
    2021-01-12 16:19

    Using JavaScript, you can achieve this:

    document.onload = function() {  
      document.getElementById("question-box-0").focus();
    }
    

提交回复
热议问题