jquery实现html中单选按钮的切换选中

来源:互联网 发布:数据新常态 mobi 编辑:程序博客网 时间:2024/04/30 20:06

jquery实现html中单选按钮的切换选中

<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>damo</title></head><script src="jquery.js"></script><body>    <input type="radio" class="radio" checked="checked" name="radio" value='1'><br/>    <input type="radio" class="radio" name="radio" value='0'></body><script >$('.radio').click(function(){    if( $(this).val()=='1'){        $(this).attr('checked',false);        $(this).val('0');    }else{        $(this).val('1');    }    //其他兄弟节点值为0    $(this).siblings().val('0');   })</script></html>
0 0
原创粉丝点击