I am styling using javascript. How to hide css styles text on my html? It seems if I put css styles using javascript,it will show on my html.
Instead of adding separate style in javascript. You can add classes which will have all the styling:
var element = document.getElementById("myDiv");
element.classList.add("myStyle");
.myStyle {
display: flex;
width:100px;
height:100px;
background-color: green;
justify-content: center;
}
<div id="myDiv"></div>