Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How change css of disabled input checkbox tag?..because it's too light and hard to see

Tags:

javascript

css

Guys, I have some input checkbox tags: They look pretty light and hard to see or print. I tried restyle the checkbox, it seems that the disabled checkbox's style can't be changed? Do you guys have any idea? Thanks a lot! :)

like image 808
Lei Avatar asked Jan 21 '23 00:01

Lei


2 Answers

The trick is to not actually disable the checkbox but intercept the click action of the "disabled" textbox so it functions as if it was disabled from that point you can style it and it will look how you want.

What you will do is add this on your "disabled" checkboxes instead of disabled="disabled":

onclick="return false;"

EDIT: As someone noted below there is a drawback to using this method. The value of the checkbox will still be posted back to the server since it is technically enabled whereas if you used the supported method you would lose control over the look but wouldn't have to deal with this additional data. (Thanks Robert)

like image 161
Adrian Avatar answered Jan 30 '23 18:01

Adrian


If you're using default checkboxes with default styling, you shouldn't worry too much. They've designed them just fine to be seen as they should be.
Could as well be your monitor contrast/brightness setting.

but if you're using some custom checkbox design, you will most probably have to change images.

like image 35
Robert Koritnik Avatar answered Jan 30 '23 20:01

Robert Koritnik