html设置label hidden,css - Can I select hidden HTML radio button using an assigned label? - Stack Over...

So, I'm trying to get away with murder here, or at least I feel like I am. I am making an HTML calendar that will allow users to choose a day and submit the form to the server side for more processing without using javascript. Here is a snippet of my HTML:

30

$1.00

31

$1.00

1

$1.00

Here is my CSS:

.day input {

display: none;

}

For good measure here is screenshot of what I am doing both with and w/o the radio buttons hidden:

qE3jS.png

EwRv9.png

The idea is that when the user clicks on the label (which is not hidden) the radio button it is attached to via the "for" attribute it will become checked. However, watching the behavior in the Chrome Developer Tools shows no change in the "checked" attribute of the radio button input element.

If I change the CSS to this:

.day input {

display: inline-block;

}

The radio button is checked every time I click on the label it is associated with. Any ideas? Am I doing this wrong?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值