Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Time autofocus property

Input Time autofocus property

Input Time Object Reference Input Time Object

Example

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

var x = document.getElementById("myTime").autofocus;

x

The output is:

true

Try it »


Definition and Usage

The autofocus property sets or returns whether the time field automatically gets focus after the page loads.

The property reflects the HTML autofocus attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus property

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

Note: Internet Explorer or Firefox browsers do not support HTML using the type="time" attribute .


Syntax

Return the autofocus attribute:

timeObject

.autofocus

Set the autofocus attribute:

timeObject

.autofocus=true|false

Attribute 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 loading, otherwise returns false.

    Related pages

    HTML Reference Manual: HTML autofocus attribute


    Input Time Object Reference Input Time Object