How to make input autofocus in internet explorer?

前端 未结 5 891
南旧
南旧 2020-12-03 18:17

Please check out my jsfiddle

http://jsfiddle.net/WK2N3/1/

How can I make this on autofocus like it is for chrome, safari, opera and firefox for IE?

5条回答
  •  無奈伤痛
    2020-12-03 19:04

    You will have to rely on javascript to do this, since html5 autofocus is not supported in IE. There is a good blog post about it here : http://www.html5tutorial.info/html5-autofocus.php

    Basically, you first check if the attribute is supported, and then use javascript to manually focus in said input using the focus() method if it is not.

提交回复
热议问题