
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Usage of autofocus HTML5 attribute
HTML5 introduced a new attribute called autofocus that would be used as follows:
<input type = "text" name = "search" autofocus/>
This attribute is supported by latest versions of Mozilla, Safari and Chrome browsers only.
Example
You can try to run the following code to learn how to work with autofocus attribute:
<!DOCTYPE HTML> <html> <body> <form action = "/cgi-bin/html5.cgi" method = "get"> Enter email : <input type = "text" name = "newinput" autofocus/> <p>Try to submit using Submit button</p> <input type = "submit" value = "submit" /> </form> </body> </html>
- Related Articles
- Is it autofocus=“ autofocus” or autofocus in HTML5?
- HTML autofocus Attribute
- HTML autofocus Attribute
- HTML autofocus Attribute
- HTML autofocus Attribute
- HTML autofocus Attribute
- What is the usage of the cross-origin attribute in HTML5?
- Usage of HTML5 Blob.slice() method
- Usage of CSS [attribute] Selector
- HTML5 Modernizr Usage
- HTML5 preload attribute
- Attributes and usage of element in HTML5
- Attributes and usage of element in HTML5
- Composition attribute in HTML5 Canvas?
- HTML5 data-* attribute type casting strings and numbers

Advertisements