I have an element with a flexbox
div#myFlexbox{
display:flex;
}
after hide it and show it, it gets messed up.<
The class
solution works, yes.
Here's a different approach I came up with:
function showFlex(element) {
var flexContainer = document.getElementById(element);
flexContainer.setAttribute("style", "display: -webkit-box; display: -ms-flexbox; display: -webkit-flex; display: flex;");
}
showFlex( "yourIDhere" );
Note that the ID doesn't need the # when you call the function.
https://codepen.io/florantara/pen/aLeyYb/