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); }); 

http://jsfiddle.net/qkl5t/


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -