<div class="ddown">
<button class="dbtn">ABC</button>
</div>
I want to make this div hide/show when a checkbox is checked/unchecked, how can I achieve this?
<div class="ddown">
<button class="dbtn">ABC</button>
</div>
I want to make this div hide/show when a checkbox is checked/unchecked, how can I achieve this?
try The following code
<input type="checkbox" ng-model="chkCondition">
<div class="ddown" ng-show="chkCondition">
<button class="dbtn">ABC</button>
</div>
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="">
Check to show/Hide a div:
<input type="checkbox" ng-model="chkCondition">
<div class="ddown" ng-show="chkCondition">
<button class="dbtn">ABC</button>
</div>
</body>
</html>
html
<input type="checkbox" ng-model="isChecked" />
<div ng-show="isChecked" class="ddown">
<button class="dbtn">ABC</button>
</div>
Try with using ng-if
to avoiding DOM element creation.
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="">
<input type="checkbox" ng-model="isChecked">
<div class="ddown" ng-if="isChecked">
<button class="dbtn">ABC</button>
</div>
</body>
</html>