jQuery. Checkbox problem
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.
精彩评论