【发布时间】:2017-06-20 11:38:37
【问题描述】:
这是我的html
<form name="sales">
<div class="sale-type">
<p>Which would you like to sell?</p>
<fieldset class="md-form form-group">
<input ng-model="art.originalForSale" name="originalForSale" type="checkbox" class="filled-in" id="checkbox2">
<label for="checkbox2">My Original ART</label>
</fieldset>
<fieldset class="md-form form-group">
<input ng-model="art.printForSale" name="printForSale" type="checkbox" class="filled-in" id="checkbox22">
<label for="checkbox22">Prints of my ART</label>
</fieldset>
</div>
<button type="submit" ng-disabled="sales.$invalid" class="btn-form btn-next c-sprite" alt="Submit"></button>
</form>
我想显示至少需要一个复选框的验证消息,我该怎么做
从这个问题How to require at least 1 checkbox for AngularJS Form Validation?找到解决方案
但它使用脚本我想要一个不使用脚本的解决方案
目前我正在使用
<span ng-show="part1.originalForSale.$error.required" class="error">Checkbox required</span>
【问题讨论】:
标签: javascript html angularjs