Sync checkboxes without JS
Super simple;
I have two checkboxes on the page, I can use whatever attributes I like so long as there is no JavaScript being run.
The result I want is that when one of them is clicked on, both of them become checked.
Then, when either is clicked again, both become unchecked.
I swear I did this before, I'm not dreaming it up am I?
9 Replies
could you wrap one in a label for the other, and the other in a label for the one?
just thinking out loud
oh, maybe...
hm, doesn't seem to work in firefox :/
sadly not, this just acts as two checkboxes
Maybe you can style each input to look like it's checked when the other actually is... But actually doing it without JavaScript I don't think it's possible?
I'm really curious about the use case too
does this count as "whatever attribute"?
![](https://utfs.io/f/5430a140-5c58-405f-b4ab-39d24dfb1341-l0q59n.png)
it meets "whatever attribute" but not "no JavaScript being run" unfortunately
I'm trying to cheese markdown's checklist feature to have a "this OR this" where they're separate checkboxes but completing one counts as completing the other
I can put html in there, but CSS or JS get stripped by and responsible site I might publish on, eg GitHub
I can work around it with something like
but I was sure you could sync checkboxes with pure HTML
nah, there isn't a html-only solution for this. can not see how