user642178
user642178

Reputation:

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.

Upvotes: 0

Views: 81

Answers (2)

Kyle Sletten
Kyle Sletten

Reputation: 5413

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.

Upvotes: 2

Naveed Ahmad
Naveed Ahmad

Reputation: 3175

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/

Upvotes: 2

Related Questions