I am trying to make changed to CSS with the DOM in JS, I have succeeded with changing the HTML attributes but not the CSS attributes. It seems that CSS is not affected by this particular DOM.
Code looks like this...
<style>
#circle1{
width: 50px !important;
height: 50px !important;
position: absolute !important;
top: 200px !important;
left: 405px !important;
background: black !important;
border-bottom-left-radius: 50px !important;
border-bottom-right-radius: 50px !important;
border-top-left-radius: 50px !important;
border-top-right-radius: 50px !important;
z-index: 10 !important;
visibility: hidden !important;
}
</style>
</head>
<body>
<script type="text/javascript">
function showCircle(){
document.getElementsByName ("circle").style.visibility="visible";
}
</script>
<div id="circle1" name="circle"></div>
<input type="button" onclick="showCircle()" value="show circle with display property">
</body>
Try this
function showCircle(){
document.getElementsByName("circle")[0].style.visibility="visible";
}
and remove !important
from css
class for visibility attribute