This is a best practice question. I am working on a HTML template in which I want to appear/disappear div elements based on user interaction.
I use JQuery for that and everything works ok.
Adding to the divs I need to hide:
$("#_panel_msg").append('<br><i> Downloading excel file with settlements..</i><br>');
I would place them where you want them to actually appear, but obviously have them hidden initially (like you have got now). Then use show/hide methods to display them, rather than appending them:
<div id="myDiv" style="display:none">Contents</div>
... Then when you want to display it:
And to hide it again: