Whenever the page is refreshed, I notice that my second <div>
is displayed, which I would like to prevent.
$(function(){
$("#div2").hide();
$("button").click(function(){
$("#div1").hide()
$("#div2").fadeIn(1000)
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="div1">
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Doloribus sequi omnis veritatis dicta laborum iste provident, ex ratione, neque veniam quis. Hic repellat nulla in minus! Sit quia dicta modi.
<button id="button">Click</button>
</div>
<div id="div2">
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Doloribus sequi omnis veritatis dicta laborum iste provident, ex ratione, neque veniam quis. Hic repellat nulla in minus! Sit quia dicta modi.
</div>