Ask Your Question
0

How to customize checkboxes and radio?

asked 2020-04-07 23:25:56 -0500

rita.fulop108 gravatar image

updated 2020-04-08 13:21:58 -0500

aze gravatar image

How can I change the default look of the checkbox and radio?

Here I've tried to do it, but it seems that it's always checked, although I have put a CSS formatting to hide checkmark when unchecked: https://codepen.io/RitaFulop108/pen/v...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-04-08 13:21:29 -0500

aze gravatar image

updated 2020-04-08 13:22:36 -0500

Well, that was a tricky one :)

If you put the for="color" attribute for the label that means you want to control the id="color"-ed checkboxes. There're no checkbox like that, so clicking on the label doesn't do anything (and if nothing happens with the checkbox the :checked state won't change as well). But if there's no for property but you have an input in the label (like you have the checkboxes) then the label will control the checkbox.

Long story short, remove the for attributes from the labels, and it'll work :) Nice and advanced thing to do by the way :)

edit flag offensive delete link more

Comments

Thank you so much! :)

rita.fulop108 gravatar imagerita.fulop108 ( 2020-04-08 15:17:04 -0500 )edit

yaay, another accepted answer :D

aze gravatar imageaze ( 2020-04-08 15:25:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-07 23:25:56 -0500

Seen: 215 times

Last updated: Apr 08