I have encountered this situation multiple times, but unfortunately, I have not been able to find a simple solution or a website that explains the process and reasoning behind it.
My goal is to create a container (div
) that includes both a loading element and the actual form within it.
<div id="mycontainer" class="container">
<div class="loading"&gT;// Displaying a loading GIF or message
<div>
<div class="myactualform">
<input id="firstname" />
<input id="btnSend" type="button" />
</div>
</div>
My question revolves around how to hide "myactualform" and show "loading", while ensuring that the loading space occupies the same area as "myactualform". I believe this may involve altering z-index
s, indicating a CSS-related issue.
Note:
I attempted to use
$(".classname1").hide()/$(".classname2").show()
from jQuery, but encountered an issue where the div size reduces.
I have created a jsfiddle project at: http://jsfiddle.net/aHW33/ (the HTML code on the page differs slightly to demonstrate an expanded version)