Toggle two checkboxes with one click and without js

泪湿孤枕 提交于 2019-12-11 03:59:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!