问题
Is there a way to toggle two combined checkboxes with one click?
I have a small calander where I want to select weeks with checkboxes. One week can be in two month so I have two checkboxes for the same week. How can I combine them safe?
I'm using this abstract HTML:
<label for="aa"><input type="checkbox" id="bb" /></label><br />
<label for="bb"><input type="checkbox" id="aa" /></label>
See my updated fiddle for a full example.
This works fine in Firefox (exept you make a double click) in the IE9 is just the checkbox toggled where you click on.
Please don't suggest to use JavaScript. I know that this would be very simple.
回答1:
How about only having one checkbox? I mean, there's only one week, although it spans months it isn't two entire weeks! Consider your design, i.e. Week Ending 4/5/2012 is a week ending in May, sure it starts in April but if you're going to put your weeks in a bag, do it by something definitive if you can.
来源:https://stackoverflow.com/questions/10829768/toggle-two-checkboxes-with-one-click-and-without-js