开发者

jQuery. Checkbox problem

开发者 https://www.devze.com 2023-03-03 05:29 出处:网络
See http://jsfiddle.net/kzaRh/ 开发者_如何学运维Click on Renew label, and checkbox will be selected. But if you click on checkbox input, then Renew label will not work.Why using this way? That\'s the

See http://jsfiddle.net/kzaRh/ 开发者_如何学运维Click on Renew label, and checkbox will be selected. But if you click on checkbox input, then Renew label will not work.


Why using this way? That's the good practice:

<input id="autoRenew" type="checkbox" />
<label for="autoRenew">Renew</label>

No javascript required. Jsfiddle: http://jsfiddle.net/kzaRh/4/


Why don't you just use a <label for="autoRenew">Renew</label>? If you do, it will automatically take care of checking/un-checking the associated box.

0

精彩评论

暂无评论...
验证码 换一张
取 消