html5 - 如何获取radio的的值
PHPz
PHPz 2017-04-17 13:17:37
0
2
968
<p class="form-group">
    <label class="control-label col-md-3">性别 <span class="required"> * </span>
 
    </label>
    <p class="form-md-radios ol-md-4">
        <p class="md-radio-inline">
            <p class="md-radio md-radio">
                <input name="gender" id="radio1" type="radio" class="md-radiobtn" value="" checked="">
                <label for="radio1"> <span></span>
 <span class="check"></span>
 <span class="box"></span> 男士</label>
            </p>
            <p class="md-radio has-error">
                <input name="gender" id="radio2" type="radio" class="md-radiobtn" value="">
                <label for="radio2"> <span></span>
 <span class="check"></span>
 <span class="box"></span> 女士</label>
            </p>
        </p>
    </p>
</p>

因为我这些表单填写完成后要生成一个预览页面,最好不用js实现,求解!
预览界面的代码:

<p class="form-group">
    <label class="control-label col-md-3">性别:</label>
    <p class="col-md-4">
        <p class="form-control-static" data-display="gender"></p>
    </p>
</p>

表单页面

提交前预览页面

PHPz
PHPz

学习是最好的投资!

reply all(2)
刘奇

If you use jQuery

// 以`性别`单选举例
$('input[type="radio"][name="gender"]:checked').val();
刘奇
  1. It can be implemented using JS, and the page does not need to jump

  2. can be implemented with server language, and the page can be jumped

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template