
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Automatically Focus an Element on Page Load in HTML
Use the autofocus attribute to specify that the element should get focus automatically on page load in HTML −
Example
You can try to run the following code to learn how to implement autofocus attribute in HTML −
<!DOCTYPE html> <html> <body> <p>Click on the below button to generate an alert box.</p> <button type = "button" autofocus onclick = "alert('Welcome!')">Result</button> </body> </html>
Advertisements