如何读取单选框里的值,当id都为="sex"时显示重复
前端
<div class="layui-form-item" lay-filter="sex">
<label class="layui-form-label">选择性别</label>
<div class="layui-input-block" id="sex">
<input type="radio" name="sex" value="男" title="男" checked>
<input type="radio" name="sex" value="女" title="女">
</div>
</div>
JS var gender=$('#sex input[name="sex"]:checked ').val()