UPDATE: So it seems that display:none is not working at all, when visibility:hidden is removed from the .hide class the divs show up, so it's an issue with display:none not working here.
UPDATE#2: OK so basically all the divs also have a .panel class which handles all the styling and has a display flex on it which is overriding the display:none from the .hide class. The issue now is how to give the .hide class higher priority without using !important.
_____________________________________
In my html I have a form with a few divs inside it and each div has a button which when clicked adds a .hide class to the div and removes the .hide class from the next div, until we get to the last div and then the form is submitted with all the data.
So the HTML is basically like this:
<form>
<div class='panel' id='div1'></div>
<div class='hide panel' id='div2'></div>
<div class='hide panel' id='div3'></div>
<div class='hide panel' id='div4'></div>
</form>
And the .hide class is:
.hide {
display:none;
visibility: hidden;
}
The issue I am having is that even though the divs show and dissapear properly they still seem to be on the page so that you have to scroll down a lot of empty screen space to get to the footer.
I am assuming this has something to do with the fact that the divs are inside a form and even though the div's are being set to display:none the form is still there so they arent going away.
How do I get this to work???
Thanks
question from:
https://stackoverflow.com/questions/65919508/how-to-get-display-none-to-work-for-div-inside-a-form 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…