首页 > 编程知识 正文

bootstrap单选按钮动态赋值,bootstrap获取单选框数据

时间:2023-05-03 12:00:49 阅读:227180 作者:2570

html文件里的简单的单选框:

<div class="form-group has-feedback"> 账单分类:<br/> <input type="radio" class="control-label" id="richang" value="日常支出" name="category" checked/>日常支出 <input type="radio" class="control-label" id="dae" value="大额支出" name="category" />大额支出</div>

 bootstrap模态框里的单选框:(本来还以为和普通的不一样,我是前端小菜哈)

<div class="form-group"> <label for="category" class="control-label">账单分类:</label><br /> <input type="radio" class="control-label" id="richang" value="日常支出" name="category" checked/>日常支出 <input type="radio" class="control-label" id="dae" value="大额支出" name="category" />大额支出</div>

但它们在js里取值是同一种方式:

var category = $('input:radio[name="category"]:checked').val();

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。