码迷,mamicode.com
首页 > 其他好文 > 详细

toggle input radio

时间:2016-03-26 12:05:20      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

$(function(){
    $(input[name="rad"]).click(function(){
        var $radio = $(this);

        // if this was previously checked
        if ($radio.data(waschecked) == true)
        {
            $radio.prop(checked, false);
            $radio.data(waschecked, false);
        }
        else
            $radio.data(waschecked, true);

        // remove was checked from other radios
        $radio.siblings(input[name="rad"]).data(waschecked, false);
    });
});

 

<input type="radio" id="aa" name="rad" data-waschecked="true" class="ico-green">

 

toggle input radio

标签:

原文地址:http://www.cnblogs.com/alone2015/p/5322380.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!