To hide the element visually, but keep it in the html, you can use:
<div style='visibility:hidden; overflow:hidden; height:0; width:0;'>
[content]
</div>
or
<div style='visibility:hidden; overflow:hidden; position:absolute;'>
[content]
</div>
What may go wrong with display:none
? It removes the element completely from the html, so some functionalities may be broken if they need to access something in the hidden element.