Input Month autofocusProperty

Input Month 对象参考手册Input Month Object

Example

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

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

Try it Yourself »

Definition and Usage

The autofocus property is used to set or return whether the month 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, Opera 12 and earlier Opera versions do not support this attribute.

Note:Internet Explorer or Firefox browsers do not support <input> elements with type="month".


Syntax

Return the autofocus attribute:

monthObject.autofocus

Set the autofocus attribute:

monthObject.autofocus=true|false

Property Values

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

Technical Details

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


Related Pages

HTML Reference Manual:HTML <input> autofocus attribute


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