I want to Hide a div On a button click. Here I am having 2 divs (Login and container). When the page loads, container will be hidden. And On click on a #submit button, I want to show the container div and hide the Login div.
The problem is Now login page is showing when the page loads, but After clicking the button I cannot make the div hide or show
Javascript:
<script> $('#submit').click(function() { console.log("Called2") $('#container').show(); $('#login').hide(); }); </script> HTML:
<div id="login" > <div id="loginformcontainer"> <form> <label> Username: <input type="text" name="uname"> </label> <label> Password: <input type="password" name="pwd"> </label> <div class="buttons1"> <button type="button" id="submit" value="Login" class="btn"> Submit </button> <button type="reset" id="reset" value="Reset" class="btn"> Clear All </button> </div> <div> <div id="container" style="display: none;"> <p> Index Page</p> </div>