为了在js文件中动态显示/隐藏div,另外,隐藏后不在页面上占据位置:
<div id="xxx" ng-show="false">
在js文件中将该div设置可见,则,
$("#xxx").setAttribute("ng-show", "true");
但依旧不显示
在chrome调试页面也看到该<div id="xxx" ng-show="true">了,
调试界面styles栏发现ng-hide:not......类下面有个属性:display: none !important;从而导致了即使ng-show="true"了,但还是不显示
因此一开始在页面使用
<div id="xxx" style="display: none;">
在js文件中就可以使用
$("#xxx").style.display = "block";
来实现显示,反之亦然。