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

HTML DOM Input Week autofocus Property

Input Week autofocus property

Input Week Object Reference The Input Week object

Example

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

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

x

The output is:

true

Try it »


Definition and Usage

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

This attribute 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 .


Syntax

Return the autofocus attribute:

weekObject

.autofocus

Set the autofocus attribute:

weekObject

.autofocus=true|false

Attribute values

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

    Technical Details

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

    Related pages

    HTML Reference Manual: HTML autofocus attribute


    Input Week Object Reference The Input Week object