Remi
Remi

Reputation: 5367

checkboxes default checked greyed out

Is there a way in html markup to have a checkbox greyed-out and checked?

I wan't to keep the checkbox styled depending on the browser, so not alter it too much with css.

I'm trying to have a row of 4 checkboxes. One is checked and blue by default, the other three are disabled and greyed out. When you either: - click on the first one the other three become actively blue again - or when you click on one of the three disabled ones the first one becomes inactive

Upvotes: 0

Views: 4891

Answers (3)

Rob Scott
Rob Scott

Reputation: 8049

<input type="checkbox" checked onclick="return false"/> 

OR

<input type="checkbox" checked disabled /> 

The disabled will gray it out, the first example won't

Upvotes: 1

j08691
j08691

Reputation: 207881

<input type="checkbox" checked disabled />

Upvotes: 3

Mike Resoli
Mike Resoli

Reputation: 967

Add disabled="disabled" to the end of the input tag. If you wanted the checkbox to be ticked on load add checked instead.

Upvotes: 0

Related Questions