Assign "selected" to radio label with jquery -
i have group of radio inputs associated labels. there css magic pretty buttons, , works fine. need able change selected attribute of label.
<input type='radio' id='radio1' name='resolution' value='0' selected /> <input type='radio' id='radio2' name='resolution' value='1' /> <label for='radio1' class='cb-enable selected' ><span>open</span></label> <label for='radio2' class='cb-disable ' ><span>closed</span></label>
how go setting label selector jquery?
$("input:radio[name='resolution']").change(function(){ $("label").removeclass("selected"); $("label[for='" + this.id + "']").toggleclass("selected", this.checked); });
Comments
Post a Comment