- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 specify that an element should be pre-selected when the page loads in HTML?
Use the checked attribute to specify an <input> element is to be pre-selected on page load. The attribute works with −
<input type = "checkbox"> <input type = "radio">.
Example
You can try to run the following code to implement checked attribute in HTML −
<!DOCTYPE html> <html> <body> <p>Which sports do you like?</p> <form action = "" method = "get"> <input type = "checkbox" name = "vehicle" value = "football" checked> Football<br> <input type = "checkbox" name = "vehicle" value = "cricket" checked> Cricket<br> <input type = "checkbox" name = "vehicle" value = "hockey"> Hockey<br> <input type = "submit" value = "Submit"> </form> </body> </html>
- Related Articles
- How to specify that an option should be pre-selected when the page loads in HTML?
- How to specify that the element should automatically get focus when the page loads in HTML?
- How to specify if and how the author thinks the audio/video should be loaded when the page loads in HTML?
- How to specify that the form should not be validated when disabled in HTML?
- How to specify whether the content of an element should be translated or not in HTML?
- How to specify that the details should be visible to the user in HTML?
- How to specify that an element is not yet relevant in HTML?
- How to refer to a element that contains pre-defined options for an element in HTML?
- How to specify the number of columns an element should be divided into with CSS
- How to specify that the element must be filled out before submitting the form in HTML?
- How to specify that the element is read-only in HTML?
- How to specify whether the or the element should have autocomplete enabled in HTML?
- How do we specify that the list order should be descending (9,8,7, 6, 5...) in HTML?
- How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?
- How to set that the specified element/group of elements should be disabled in HTML?

Advertisements