【发布时间】:2020-06-25 09:12:13
【问题描述】:
我有一个要求,当提交的表单没有任何值时,我必须将单选按钮的边框颜色更改为红色
我用“required”关键字创建了一个自定义单选按钮控件
<input type="radio" id="test1" name="{{'valee' + i + j}}" [(ngModel)]="entity.test" [value]="true" #dept_multimediatransfer="ngModel" required>
Oui
<input type="radio" id="test2" name="{{'valee' + i + j}}" [(ngModel)]="entity.test" [value]="false" #dept_multimediatransfer="ngModel" required>
Non
input[type="radio"] {
/* remove standard background appearance */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* create custom radiobutton appearance */
display: inline-block;
width: 14px;
height: 14px;
padding: 2px;
/* background-color only for content */
background-clip: content-box;
border: 1px solid #bbbbbb;
// background-color: #e7e6e7;
border-radius: 50%;
}
/* appearance for checked radiobutton */
input[type="radio"]:checked {
background-color: #4A4A4A;
}
css:
input.ng-invalid.ng-touched:not(.field-control), select.ng-invalid.ng-touched, p-calendar.ng-invalid.ng-touched > span, input.master-invalid:not(.field-control) {
border: solid 1px red;
}
它在 chrome 中运行良好,但在 IE 中无法运行,有人可以帮忙
【问题讨论】:
-
你能创建a stackblitz example吗?
-
如果您使用的是 HTML5,那么您需要添加一个元标记以使其在 IE 中工作。
<meta http-equiv="X-UA-Compatible" content="ie=edge"> -
没用!!
标签: css angular radio-button required