W3Schools.com

HTML <input> checked Attribute

HTML input Tag Reference HTML <input> tag

Example

An HTML form with a pre-selected checkbox:

<form action="form_action.asp">
<input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
<input type="checkbox" name="vehicle" value="Car" checked="checked" /> I have a car <br />
</form>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The checked attribute is supported in all major browsers.


Definition and Usage

The checked attribute specifies that an <input> element should be pre-selected when the page loads.

The checked attribute can be used with <input type="checkbox"> or <input type="radio">.

The checked attribute can also be set after the page load, with a JavaScript.


Syntax

<input checked="checked" />

Attribute Values

Value Description
checked Preselects the checkbox or radio button


HTML input Tag Reference HTML <input> tag
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE