Input Time autofocusProperty

Input Time 对象参考手册Input Time Object

Example

Check whether the time field automatically gets focus after the page loads:

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

Try it yourself »

Definition and Usage

The autofocus property is used to set or return whether the time field automatically gets focus after the page loads.

This property reflects the HTML autofocus attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus attribute

Note:Internet Explorer 9 and earlier IE versions, or Opera 12 and earlier Opera versions, do not support the autofocus attribute.

Note:Internet Explorer and Firefox browsers do not support HTML <input> elements using the type="time" attribute.


Syntax

Return the autofocus property:

timeObject.autofocus

Set the autofocus property:

timeObject.autofocus=true|false

Property Values

Value Description
true|false Describes whether the time field gets focus after the page loads
  • true - The time field gets focus
  • false - Default. The time field does not get focus

Technical Details

Return value: Boolean value, returns true if the time field automatically gets focus after the page loads, otherwise returns false.


Related Pages

HTML Reference Manual:HTML <input> autofocus attribute


Input Time 对象参考手册Input Time Object Other Extensions