How to place the cursor (auto focus) in text box when a page gets loaded without javascript support?

后端 未结 6 455
野趣味
野趣味 2020-12-04 17:26

I have a form with some text fields,and I want to place the cursor (auto focus) on first text field of form when page gets loaded.

I want to do it without usi

6条回答
  •  北海茫月
    2020-12-04 17:40

    An expansion for those who did a bit of fiddling around like I did.

    The following work (from W3):

    
    
    
    
    

    It is important to note that this does not work in CSS though. I.e. you can't use:

    .first-input {
        autofocus:"autofocus"
    }
    

    At least it didn't work for me...

提交回复
热议问题