
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Month autofocus Property
The HTML DOM input month autofocus property returns and modify whether the input month field should get focused or not when page load.
Syntax
Following is the syntax −
Returning autofocus
object.autofocus
Modifying autofocus
object.autofocus = true | false
Example
Let us see an example of HTML DOM input month autofocus property −
<!DOCTYPE html> <html> <head> <title>HTML DOM autofocus property</title> <style> body{ text-align:center; } p{ font-size:1.5rem; color:#ff8741; } input{} button{ background-color:#db133a; color:#fff; padding:8px; border:none; width:120px; margin:0.5rem; border-radius:50px; outline:none; cursor:pointer; } </style> </head> <body> <h1>autofocus Property Example</h1> <p>Hi! click on disable button to disable autofocus</p> <input type="month" autofocus value="2019-03"> <br> <button onclick="disable()">Disable</button> <script> function disable() { document.querySelector("input").autofocus = false; } </script> </body> </html>
Output
This will produce the following output −
Click on “Disable” button to disable the autofocus on month input field.
- Related Articles
- HTML DOM Input URL autofocus Property
- HTML DOM Input Week autofocus Property
- HTML DOM Input Password autofocus Property
- HTML DOM Input Search autofocus Property
- HTML DOM Input Submit autofocus property
- HTML DOM Input Text autofocus Property
- HTML DOM Input Radio autofocus property
- HTML DOM Input Range autofocus property
- HTML DOM Input Reset autofocus property
- HTML DOM Input Checkbox autofocus Property
- HTML DOM Input Number autofocus Property
- HTML DOM Input Color autofocus Property
- HTML DOM Input Date autofocus Property
- HTML DOM Input Datetime autofocus Property
- HTML DOM Input Email autofocus Property

Advertisements