AsherMaximum AsherMaximum - 7 months ago 23
Javascript Question

Partially select checkbox with javascript

Is there a way using Javascript and HTML(5) to make a checkbox be partially selected, like the checkboxes in a program installation menu when you select only some of the sub options?


HTML5 defines the indeterminate boolean property.

I've tested it only in the latest Safari, Chrome, and Firefox. They all support the indeterminate state.


Edit: Note that this wont work with older browsers and maybe not with current versions of IE. You'd need to rely on hacks as described in other answers here if you want to support all browsers.