This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes default behavior of a checkbox to be checked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "default behavior of a checkbox to be checked" Watch "default behavior of a checkbox to be checked" New topic

default behavior of a checkbox to be checked

Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 421

No matter what I do, this page loads unchecked.

Any ideas?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63232

Something else must be at play here. Perhaps some script that strips the checked attribute?

By the way, using checked="true" is a really bad idea. It leads one to believe that checked="false" will uncheck the box, but it won't. Both checked="true" and checked="false" do the exact same thing: make the checkbox checked. In fact, any value assigned to checked will make the checkbox checked; for example checked="jfdhgfdhgkfdhg".

If you are using HTML4 or HTML5, it should just be checked. If you are using XHTML (archaic), it should be checked="checked". (HTML5 will actually allow either form, but really, why use XML notation for something that's not XML?)

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Have you checked out Aspose?
subject: default behavior of a checkbox to be checked
It's not a secret anymore!