开发者

jQuery toggle class of label when radio button is clicked

I have a label surrounding my radio button where the background is supposed to change on :hover and :focus

<label for="radio1" class="radio-blur">
<input name="j开发者_如何学运维ob" id="radio1" value="1" type="radio"> Graphic Design</label>

I want to change the class from .radio-blur to .radio-focus

I have

    $(document).ready(function(){
        $('input:radio').click(function() {
            $(this).parent('label').toggleClass('.radio-focus');
        });  
    }); 

But it doesn't work... please help


Remove the dot in the class

$(this).parent('label').toggleClass('radio-blur radio-focus');

JSFiddle

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜