[英]how to show hide a div on dynamic checkbox click event using javascript
Here is my html table 这是我的HTML表格
<table >
<tbody>
<tr ng-repeat="CU in InboxList">
<td>
<input type="checkbox" onclick="ShowHideDiv(this)" id="checkmailID" ng-model="CU.selected" value="{{CU.InboxMailID}}">
</td>
</tr>
</tbody>
</table>
and here is my div which i want to show/hide. 这是我要显示/隐藏的div。
<div id="dvPassport">
<button type="submit" data-placement="top" title="Move to trash"></button>
</div>
i have already created a javascript for show/hide the div which is working fine.here is my code. 我已经创建了一个用于显示/隐藏div的javascript,效果很好。这是我的代码。
<script type="text/javascript">
function ShowHideDiv(checkmailID) {
debugger
var dvPassport = document.getElementById("dvPassport");
dvPassport.style.display = checkmailID.checked ? "inline-block" : "none";
}
</script>
there is no problem when i am checking single,mutiple dynamic checkboxes the div is opening.actually i am trying to hide the div when all the checkboxes are unchecked in my html table .the div will show when atleast one checkbox is checked 当我检查div正在打开的单个,多个动态复选框时没有问题。实际上,当我的html表中的所有复选框都未选中时,我正在尝试隐藏div。当选中至少一个复选框时,div将显示
<div [hidden] = "value" style="display: inline-block" id="dvPassport">
<button type="submit" data-placement="top" title="Move to trash"></button>
</div>
can you try this please , if you edit the value
via javascript you can hide an unhide the division 您可以尝试一下吗,如果您通过javascript编辑value
,则可以隐藏取消隐藏分区
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.