freemarker实现两个单选框

需求:平台需要实现一个小功能,功能为显示表达是否需要存储squirrel,默认选择否,标记值为0,如果选择是则标记值为1

<hr>
<div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-4">
        <label>存储squirrel</label>
        <div class="custom-controls-stacked">
            <div class="row">
            <div class="checkout-checked" >
            <label class="custom-control custom-radio">
                <input type="radio" checked='checked' name="storeSquirrel" class="custom-control-input" id="storeSquirrel"  value=0>否
            </label>
            </div>
            <label class="custom-control custom-radio">
                <input type="radio" name="storeSquirrel" class="custom-control-input" id="storeSquirrel"  value=1>是
            </label>
            </div>
        </div>
    </div>
</div>
<hr>

输出前端


var storeSquirrel = 0;

$( "input[name='storeSquirrel']:checked" ).each(function() {
    storeSquirrel += $(this).val();
});

submitData["storeSquirrel"] = storeSquirrel;

后面的代码为表单提交的时候的提交标记值的操作





阅读更多
文章标签: freemarker spring java
个人分类: js
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭