我正在使用自定义单选按钮。还向它添加了必需的属性。html中自定义单选按钮的必需属性
要求是工作,但错误没有显示....
形式没有得到,而不选择无线电提交....
但
“请选择这些选项之一“
错误未显示。
代码:
<form>
<div class="form-field-label">Change In Weight :</div>
<div class="form-field-input">
<input type="radio" name="change_in_weight" id="change_in_weight1" required value="Maintained" class='radiobutton'><label for="change_in_weight1" class='radiobutton-label'>Maintained</label><br>
<input type="radio" name="change_in_weight" id="change_in_weight2" value="Increasing abnormally since last one year" class='radiobutton'><label for="change_in_weight2" class='radiobutton-label'>Increasing abnormally since last one year</label><br>
<input type="radio" name="change_in_weight" id="change_in_weight3" value="Decreasing abnormally since last one year" class='radiobutton'><label for="change_in_weight3" class='radiobutton-label'>Decreasing abnormally since last one year</label><br>
</div>
<br>
<input type="submit" value="send">
</form>
CSS:
.radiobutton-label {
display: inline-block;
cursor: pointer;
position: relative;
padding-left: 25px;
margin-right: 15px;
font-size: 15px;
}
input[type="radio"] {
display:none;
margin: 10px;
}
.radiobutton-label:before {
content:"";
display: inline-block;
width: 24px;
height: 24px;
margin-right: 10px;
position: absolute;
left: 0;
bottom: 1px;
}
input[type=radio] + label:before {
background: url('http://drdilipgadgil.com/img/vlad.png') 2px 4px no-repeat;
}
input[type=radio]:checked + label:before {
background: url('http://drdilipgadgil.com/img/vlad.png') 2px -18px no-repeat;
}
:required:focus {
box-shadow: 0 0 6px rgba(255,0,0,1);
}
这里是JSFIDDLE