<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>

<div class="container">
  <h2  >Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
		<h2 class="title">Horizontal form</h2>	
		 
        </div>
        <div class="modal-body">
          
		<!--<div class="container"></div>
		<div class="container">	</div>
			 <form class="container-fluid" action="/action_page.php">-->

    		
			<form id="login" class="form-horizontal container-fluid " action="/action_page.php">
				<div class="row">
					<div class="form-group">
					<label class="control-label col-sm-2" for="email"> </label>
					<div class="col-sm-10">
						<h3 class="modal-title titleh3">Log in</h3>
					</div>
					</div>
					<div class="form-group">
					  <label class="control-label col-sm-2" for="email">Email:</label>
					  <div class="col-sm-10">
						<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
					  </div>
					</div>
					<div class="form-group">
					  <label class="control-label col-sm-2" for="pwd">Password:</label>
					  <div class="col-sm-10">          
						<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd">
					  </div>
					</div>
					<div class="form-group">        
					  <div class="col-sm-offset-2 col-sm-10">
						<div class="checkbox">
						  <label><input type="checkbox" name="remember"> Remember me</label>
						</div>
					  </div>
					</div>
					<div class="form-group">        
					  <div class="col-sm-offset-2 col-sm-10">
						<button type="reset" class="btn btn-default button1 ">Reset</button>
					  
						<button type="submit" class="btn btn-default button1 ">Submit</button>
						<div class="divchangepw" >
						<p>Forgot password ?<a href="#" id="changepsw"> Change password</a></p>
						</div>
					  </div>
					</div>
				</div>
			</form>
			
			<form id="changepw" class="form-horizontal container-fluid" action="/action_page.php">
				<div class="row">
					<div class="form-group">
					<label class="control-label col-sm-2" for="email"> </label>
					<div class="col-sm-10">
						<h3 class="modal-title titleh3">Change password</h3>
					</div>
					</div>
					<div class="form-group">
					  <label class="control-label col-sm-2" for="email">Email:</label>
					  <div class="col-sm-10">
						<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
					  </div>
					</div>
					<div class="form-group">
					  <label class="control-label col-sm-2" for="pwd">Password:</label>
					  <div class="col-sm-10">          
						<input type="password" class="form-control" id="pwd" placeholder="Type password" name="pwd">
					  </div>
					</div>
					<div class="form-group">
					  <label class="control-label col-sm-2" for="pwd">Password:</label>
					  <div class="col-sm-10">          
						<input type="password" class="form-control" id="pwd" placeholder="Retype password" name="pwd">
					  </div>
					</div>
					<div class="form-group">        
					  <div class="col-sm-offset-2 col-sm-10">
						<div class="checkbox">
						  <label><input type="checkbox" name="remember"> Remember me</label>
						</div>
					  </div>
					</div>
					<div class="form-group">        
					  <div class="col-sm-offset-2 col-sm-10">
						<button type="reset" class="btn btn-default button1 ">Reset</button>
					  
						<button type="submit" class="btn btn-default button1 ">Submit</button>
						<p><a href="#" id="login2"> Log in</a> here
						</p>
					 </div>
					</div>
				</div>	
			</form>
		
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default cancel1" data-dismiss="modal">Close</button>
		  <p>Forgot password?<a href="#" id="changepsw2"> Change password</a></p>
		   <p>Not member?<a href="#"> Sign up</a></p>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>
#login{
		
		margin-left:10px;
		
	}
	#changepw{
		
		margin-left:10px;
		display:none;
	}
	@media screen and (min-width: 300px) {
    .title {
    font-size: 36px;
	text-align:center;
    }
    .titleh3{
		font-size: 28px;
	}
	.divchangepw{
		width:50%;
	}
	.button1{
		float:right;
		margin-left:20px;
		display:inline-block;
	}
	.cancel1{
		float:left;
		margin-left:20px;
		
	}
}

@media screen and (max-width: 300px) {
    .title {
    font-size: 28px;
	text-align:center;
	}
    .button1{
		width:100%;
		margin-left:0px;
		display:block;
		margin-bottom:20px;
	}
	.cancel1{
		width:100%;
		margin-left:0px;
		display:block;
		margin-bottom:20px;
	}
	.titleh3{
		font-size: 22px;
	}
	.divchangepw{
		width:100%;
	}
}
$(document).ready(function(){
		$("#changepsw").on("click", function(){
			$("#login").css("display","none");
		    $("#changepw").css("display","block");
			//e.preventDefault();
		});
		$("#changepsw2").on("click", function(){
			$("#login").css("display","none");
		    $("#changepw").css("display","block");
			//e.preventDefault();
		});
		$("#login2").on("click", function(){
			$("#login").css("display","block");
		    $("#changepw").css("display","none");
			//e.preventDefault();
		});
	});
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.