Latest web development tutorials

HTML DOM Input Time autofocus attribute

Input Time Object Reference Input Time Object

Examples

See if time field is automatically get the focus when the page is loaded:

var x = document.getElementById("myTime").autofocus;
x The output is:
true

try it"

Definition and Usage

autofocus attribute is used to set or return time field whether to automatically get the focus when the page loads.

Property reflects the HTML autofocus property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus attribute

Note: Internet Explorer 9 and earlier versions of IE or Opera 12 or earlier version of Opera browser does not support autofocus attribute.

Note: Internet Explorer or Firefox browser does not support type = "time" attribute of the HTML <input> elements.


grammar

Back autofocus properties:

timeObject .autofocus

Setting autofocus properties:

timeObject .autofocus=true|false

Property Value

描述
true|false 描述了 time 字段在页面加载后是否获取焦点
  • true - time 字段获取焦点
  • false - 默认。time 字段不获取焦点

technical details

return value: Boolean field if the page time to get the focus automatically after loading returns true, otherwise returns false.


Related Pages

HTML Reference Manual: HTML <the INPUT> The autofocus attribute


Input Time Object Reference Input Time Object