[whatwg] HTML inputs directly toggling CSS classes on elements?

Roger Hågensen rh_whatwg at skuldwyrm.no
Sun Sep 10 04:25:32 PDT 2017


On 2017-09-09 18:41, Alex Vincent wrote:
> A few days ago, I dipped my toes into web design again for the first time
> in a while.  One of the results is the CSSClassToggleHandler constructor
> from [1].  Basically, it takes an radio button or checkbox, and turns that
> input into a toggle for a CSS class on another element.

You do have :checked

While I haven't used that with radio or checkboxes much myself it seems 
to at least partially do what you are describing.

https://developer.mozilla.org/en-US/docs/Web/CSS/:checked




-- 
Unless specified otherwise, anything I write publicly is considered 
Public Domain (CC0). My opinions are my own unless specified otherwise.
Roger Hågensen,
Freelancer, Norway.


More information about the whatwg mailing list