kartul Posted April 7, 2011 Share Posted April 7, 2011 Hey all I want to make that when I click on login, the login div appears (and if registration div is visible, hide it first) and vise-versa. here is my code so far: <script> $(document).ready(function() { $("#tLogin").click(function() { $("#login").slideToggle("slow"); }); $("#tRegister").click(function() { $("#register").slideToggle("slow"); }); }); </script> <div id="pHeader"> <div id="login"> <form action="index.php" method="POST"> <p> <label for="username">Username</label> <input type="text" name="username" id="username"> </p> <p> <label for="password">Password</label> <input type="password" name="password" id="password"> </p> <p> <input type="submit" name="login"> </p> </form> </div> <div id="register"> <form action="index.php" method="POST"> <p> <label for="username">Username</label> <input type="text" name="username" id="username"> </p> <p> <label for="password">Password</label> <input type="password" name="password" id="password"> </p> <p> <label for="password">Password</label> <input type="password" name="passwordCheck" id="passwordCheck"> </p> <p> <label for="email">E-mail</label> <input type="email" name="email" id="email"> </p> <p> <input type="submit" name="register"> </p> </form> </div> Link to comment https://forums.phpfreaks.com/topic/233027-jquery-slidetoggle-hide-other-elements/ Share on other sites More sharing options...
Adam Posted April 8, 2011 Share Posted April 8, 2011 Try this: $(document).ready(function() { $("#tLogin").click(function() { $("#login").slideToggle("slow"); if (("#register").is(":visible")) { $("#register").hide(); } }); $("#tRegister").click(function() { $("#register").slideToggle("slow"); if (("#login").is(":visible")) { $("#login").hide(); } }); }); Link to comment https://forums.phpfreaks.com/topic/233027-jquery-slidetoggle-hide-other-elements/#findComment-1198629 Share on other sites More sharing options...
yogi123 Posted September 23, 2011 Share Posted September 23, 2011 You can get it here, try this http://www.webtrickss.com/javascript/jquery-slidetoggle-signup-form-and-login-form/ Hope it will help full for you! Link to comment https://forums.phpfreaks.com/topic/233027-jquery-slidetoggle-hide-other-elements/#findComment-1271960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.