表单

设置单选框时,记住将其name设为相同值,这样才能实现单选框!!

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"> 
    <title>Bootstrap 实例 - 复选框和单选按钮</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">  
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="checkbox">
    <label ><input type="checkbox" name="">篮球</label>
    <label ><input type="checkbox" name="">足球</label>
</div>
<div class="radio">
    <label ><input type="radio"  name="optionsRadio" checked>篮球</label>
    <label ><input type="radio"  name="optionsRadio">足球</label>
</div>
<div class="radio">
    <label>
        <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked> 选项 1
    </label>
</div>
<div class="radio">
    <label>
        <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">选项 2 - 选择它将会取消选择选项 1
    </label>
</div>
</body>
</html>

 

posted @ 2018-05-09 15:20  sunmarvell  阅读(116)  评论(0编辑  收藏  举报