I want to hide a div block and show another div block that is originally hidden (display: none). I do it by triggering onclick a jQuery function that adds or remove a class which has the CSS property 'display: none'.
It works... but just for a second or so. One div hides and the hidden one appears, but only for a second, then it returns to the original situation. How can I make it permanent until the function is triggered again?
HTML
<div class="div1">
<a href=""> Log in</a>
</div>`enter code here`
<div class="div2 notin">
<a href=""> Log out</a>
</div>
CSS
.notin {
display: none;
}
jQuery
$(document).ready(() => {
$(".div1").on("click", "a", () => {
$(".div1").addClass("notin");
$(".div2").removeClass("notin");
});
});
$(document).ready(() => {
$(".div2").on("click", "a", () => {
$(".div2").addClass("notin");
$(".div1`enter code here`").removeClass("notin");
});
});