- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to place the cursor (auto focus) in the text box when a page gets loaded with HTML?
Use the autofocus attribute to place the cursor in the text box when a page loads. The autofocus attribute is a Boolean attribute. When present, it specifies that an <input> element should automatically get focus when the page loads. Here is an example −
Example
<!DOCTYPE html> <html> <body> <form action = "/new.php"> Name: <input type = "text" name = "name" autofocus><br> Subject: <input type = "text" name = "sub"><br> <input type = "submit"> </form> </body> </html>
Advertisements