"Login and Register tabbed form"
Bootstrap 3.3.0 Snippet by pukey22

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="panel panel-login"> <div class="panel-heading"> <div class="row"> <div class="col-xs-6"> <a href="#" class="active" id="login-form-link">Login</a> </div> <div class="col-xs-6"> <a href="#" id="register-form-link">Register</a> </div> </div> <hr> </div> <div class="panel-body"> <div class="row"> <div class="col-lg-12"> <form id="login-form" action="https://phpoll.com/login/process" method="post" role="form" style="display: block;"> <div class="form-group"> <input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username" value=""> </div> <div class="form-group"> <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password"> </div> <div class="form-group text-center"> <input type="checkbox" tabindex="3" class="" name="remember" id="remember"> <label for="remember"> Remember Me</label> </div> <div class="form-group"> <div class="row"> <div class="col-sm-6 col-sm-offset-3"> <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In"> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-lg-12"> <div class="text-center"> <a href="https://phpoll.com/recover" tabindex="5" class="forgot-password">Forgot Password?</a> </div> </div> </div> </div> </form> <form id="register-form" action="https://phpoll.com/register/process" method="post" role="form" style="display: none;"> <div class="form-group"> <input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username" value=""> </div> <div class="form-group"> <input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address" value=""> </div> <div class="form-group"> <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password"> </div> <div class="form-group"> <input type="password" name="confirm-password" id="confirm-password" tabindex="2" class="form-control" placeholder="Confirm Password"> </div> <div class="form-group"> <div class="row"> <div class="col-sm-6 col-sm-offset-3"> <input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now"> </div> </div> </div> </form> </div> </div> </div> </div> </div> </div> </div>
body { padding-top: 90px; } .panel-login { border-color: #ccc; -webkit-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); -moz-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); } .panel-login>.panel-heading { color: #00415d; background-color: #fff; border-color: #fff; text-align:center; } .panel-login>.panel-heading a{ text-decoration: none; color: #666; font-weight: bold; font-size: 15px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; } .panel-login>.panel-heading a.active{ color: #029f5b; font-size: 18px; } .panel-login>.panel-heading hr{ margin-top: 10px; margin-bottom: 0px; clear: both; border: 0; height: 1px; background-image: -webkit-linear-gradient(left,rgba(0, 0, 0, 0),rgba(0, 0, 0, 0.15),rgba(0, 0, 0, 0)); background-image: -moz-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0)); background-image: -ms-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0)); background-image: -o-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0)); } .panel-login input[type="text"],.panel-login input[type="email"],.panel-login input[type="password"] { height: 45px; border: 1px solid #ddd; font-size: 16px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; } .panel-login input:hover, .panel-login input:focus { outline:none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; border-color: #ccc; } .btn-login { background-color: #59B2E0; outline: none; color: #fff; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border-color: #59B2E6; } .btn-login:hover, .btn-login:focus { color: #fff; background-color: #53A3CD; border-color: #53A3CD; } .forgot-password { text-decoration: underline; color: #888; } .forgot-password:hover, .forgot-password:focus { text-decoration: underline; color: #666; } .btn-register { background-color: #1CB94E; outline: none; color: #fff; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border-color: #1CB94A; } .btn-register:hover, .btn-register:focus { color: #fff; background-color: #1CA347; border-color: #1CA347; }
$(function() { $('#login-form-link').click(function(e) { $("#login-form").delay(100).fadeIn(100); $("#register-form").fadeOut(100); $('#register-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); $('#register-form-link').click(function(e) { $("#register-form").delay(100).fadeIn(100); $("#login-form").fadeOut(100); $('#login-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); });

Related: See More


Questions / Comments:

Hi guys!

So I did MultiForm.html, MultiForm.css as well as MultiForm.js that I copied exactly from above, but the outcome is totally different and when I clicked "Register" tab, nothing happened. Really need help ASAP. :(

The screenshot is here: https://s12.postimg.org/z7f...

Jwan Radzi () - 8 years ago - Reply -1


Add bootstrap link ref and jquery link ref too :)

Sergio Molina () - 7 years ago - Reply 0


How to load csrf_token (with this login / register page) from register form in Symfony2 FOSUserBundle?

klansser 2323 () - 8 years ago - Reply 0


SOLVED:

klansser 2323 () - 8 years ago - Reply 0


I cannot get the JS to shift me to another tab for the register tab - I just included into a <head> section of the HTML I created a
<link href="css/loginregister.css" rel="stylesheet"> which is the CSS you have, and also put <script src="js/loginregister.js"></script> . The css is now styled but the JS just isnt working. Any ideas?

Dhruv () - 8 years ago - Reply 0


Hola amigo agrega el script de jquery y te funcionará yo igual batalle saludos!

<script type="text/javascript" src="//code.jquery.com/jquery-1.10..."></script>

Angel Puc Yamá () - 8 years ago - Reply 0


Collection of Bootstrap Login Form Templates
http://www.designerslib.com...

DesignersLib () - 8 years ago - Reply 0


How do i send the form data to a php file? help me please
<form id="quick-login" role="form" class="form col-md-12 center-block" method="post" action="{$mybb-&gt;settings['bburl']}/member.php">

Chaz Cash () - 9 years ago - Reply 0


Hey how do I make it such that Register is the default active tab?

Edit: nvm i got it

Abdul Aziz () - 9 years ago - Reply 0


You just change these line below; the class="active" needs moving for which is active.

Login
</div>
<div class="col-xs-6">
Register

to:

Login
</div>
<div class="col-xs-6">
Register

Ed () - 9 years ago - Reply 0


for got code brackets

Ed () - 9 years ago - Reply 0


When the HTML from this snippet is placed inside an HTML template that is used to populate an Angular ui-view, it stops working. Clicking the "Register" link doesn't work. When I paste the HTML back in the main template in place of the ui-view, it works again. Why is the JS function not found when the html is inside a ui-view?

Alex G. () - 9 years ago - Reply 0


Hey, when using Angular, the html for the view template is not loaded until that template is activated within your UI. Because the Javascript in this snippet is executed when the web page loads, the jQuery will not find the elements which it binds the click events to.
To use it with Angular, I would create a controller for your ui view and have the functions as part of that, finally add ng-click to the html to call your controller.

Wayne Coles () - 9 years ago - Reply 0


Thanks Wayne. I ended up writing a directive to take care of this.

Alex G. () - 9 years ago - Reply 0