Try this
$(document).ready(function(){
$("button").click(function(){
$("#toggle").toggle();
});
});
div {
height:200px;
width:200px;
background-color:red;
}
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div id="toggle">
</div>
<button>Toggle between hide() and show()</button>
</body>
</html>
solved how to show and hide the div on button click using jquery [duplicate]