如何根据选中的复选框显示和隐藏div?我在angular js中使用以下代码。我有3个复选框,如果单击一个复选框,则应该显示相应的div,而另一个div应该隐藏。
<label class="checkbox-inline" style="margin-top: 7px;">
<input type="checkbox" id="chkSmall" name="small" class="bgCheck" value="small" data-ng-model="ShowSmall" data-ng-change="visibleSmall()" />
Small Clock
</label>
<label class="checkbox-inline" style="margin-top: 7px;">
<input type="checkbox" id="chkMedium" name="medium" class="bgCheck" value="medium" data-ng-model="ShowMedium" data-ng-change="visibleMedium()" data-ng-init="ShowMedium=true" />
Medium Clock
</label>
<label class="checkbox-inline" style="margin-top: 7px;">
<input type="checkbox" id="chkBig" name="big" class="bgCheck" value="big" data-ng-model="ShowBig" data-ng-change="visibleBig()" />
Large Clock
</label>
<div data-ng-show="ShowSmall">
Small Clock
</div>
<div data-ng-show="ShowMedium">
Medium Clock
</div>
<div data-ng-show="ShowLarge">
Large... or Big Clock?
</div>
答案 0 :(得分:0)