I've had a block 'jumbotron' it has next css parameters:
.jumbotron {
position: absolute;
top: 50%;
left:50%;
transform: translate(-50%,-50%);
background: rgba(0, 0, 0, 0.7);
border-radius: 20px;
}
It's looks so good in the centre of window. But now I want put "container button-block"on that. With next css parameters it looks great too..
.button-block {
position: absolute;
top: 5%;
left: 36%;
}
But if I try to change windows size my 'button-block' is starting to dance and brakes design. How can I stick these buttons to jumbotron block What decision will more common?
.jumbotron {
position: absolute;
top: 50%;
left:50%;
transform: translate(-50%,-50%);
background: rgba(0, 0, 0, 0.7);
border-radius: 20px;
}
.button-block {
position: absolute;
top: 5%;
left: 36%;
}
<div class="page-header" style="background-image: url('../assets/img/background_presentation.jpg');">
<div class="container button-block">
<button type="button" class="btn btn-default btn-circle btn-xl active">1</button>
<button type="button" class="btn btn-default btn-circle btn-xl">2</button>
<button type="button" class="btn btn-default btn-circle btn-xl">3</button>
</div>
<div class="container">
<header class="jumbotron">
<h2 class="text-center text-white header">What is the property Address</h2>
<form>
<div class="form-group">
<label for="inputAddress" class="text-white">Address</label>
<input type="text" class="form-control" id="inputAddress">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputCity" class="text-white">City</label>
<input type="text" class="form-control" id="inputCity">
</div>
<div class="form-group col-md-6">
<label for="inputZip" class="text-white">Zip</label>
<input type="text" class="form-control" id="inputZip">
</div>
</div>
<div class="col-md-12 text-center block-buttons">
<button type="submit" class="btn btn-neutral btn-lg">Continue</button>
</div>
</form>
</header>
</div>
</div>
Something like this?
.container{text-align: center;}
.jumbotron {
position: relative;
top: 50%;
display: inline-block;
margin-top: 25%;
/*transform: translate(-50%,-50%);*/
background: rgba(0, 0, 0, 0.7);
border-radius: 20px;
}
.button-block {
position: absolute;
top: -22px;
left: 36%;
}
<div class="page-header" style="background-image: url('../assets/img/background_presentation.jpg');">
<div class="container">
<header class="jumbotron">
<div class="container button-block">
<button type="button" class="btn btn-default btn-circle btn-xl active">1</button>
<button type="button" class="btn btn-default btn-circle btn-xl">2</button>
<button type="button" class="btn btn-default btn-circle btn-xl">3</button>
</div>
<h2 class="text-center text-white header">What is the property Address</h2>
<form>
<div class="form-group">
<label for="inputAddress" class="text-white">Address</label>
<input type="text" class="form-control" id="inputAddress">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputCity" class="text-white">City</label>
<input type="text" class="form-control" id="inputCity">
</div>
<div class="form-group col-md-6">
<label for="inputZip" class="text-white">Zip</label>
<input type="text" class="form-control" id="inputZip">
</div>
</div>
<div class="col-md-12 text-center block-buttons">
<button type="submit" class="btn btn-neutral btn-lg">Continue</button>
</div>
</form>
</header>
</div>
</div>
Related
I'm new to web designing. PLS help me to create this input fields responsive and also how I put margins in all around like it's in middle(I want get those columns in the middle of the page).
<!DOCTYPE html>
<html>
<head>
<title>Login/Registor</title>
<style type="text/css">
body{
margin:0px;
padding:0;
overflow-x: hidden!important;
}
.containor{
/*text-align: center;*/
margin:225px 3px 5px 3px auto;
}
.form-group input{
width: 900px;
height: 40px;
border-color: silver;
padding: 0;
margin-top: 3px;
margin-bottom: 10px;
}
.form-group label{
text-align: left;
padding-left: 3px;
margin-bottom: 3px;
}
.buttons{
margin-top: 20px;
}
</style>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
<div class="containor">
<div class="row">
<div class="col-6 col-sm-12 col-md-6 border" id="login_section">
<form class="m-3" action="#" method="post">
<div class="form-group">
<h1 class="m-3 text-center">Welcome to Login Section!</h1>
<label>Email</label>
<input type="text" class="form-control" name="u_email">
<label>Password</label>
<input type="password" class="form-control" name="paswd">
<br>
<div class="buttons">
<button type="submit" class="btn btn-outline-info btn-block rounded-pill">Login</button>
<button type="rest" class="btn btn-outline-danger btn-block rounded-pill">Clear Credentials</button>
Fogot password!
</div>
</div>
</form>
</div>
<div class="col-right-6 col-sm-12 col-md-6 border" id="reg_section">
<form class="m-3" action="#" method="post">
<div class="form-group">
<h1 class="m-3 text-center">Don't have an Account yet!<br>Resgister In Here</h1>
<label>Email</label>
<input type="text" class="form-control" name="u_email">
<label>Password</label>
<input type="password" class="form-control" name="paswd">
<label>Confirm Password</label>
<input type="password" class="form-control" name="confirm_paswd">
<br>
<div class="buttons">
<button type="submit" class="btn btn-outline-success btn-block rounded-pill">Registor</button>
<button type="rest" class="btn btn-outline-danger btn-block rounded-pill">Clear Info</button>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
if any one have samples like this create using html,css,bootsrap pls share to get more idea about theses things. Thanks
Is this what you are looking for?
If then add the below style to fix the input moving out of container.
.form-group input {
width: 900px;
max-width: 100%;
}
Working Fiddle
body {
margin: 0px;
padding: 0;
overflow-x: hidden !important;
}
.containor {
/*text-align: center;*/
margin: 225px 3px 5px 3px auto;
}
.form-group input {
width: 900px;
height: 40px;
border-color: silver;
padding: 0;
margin-top: 3px;
margin-bottom: 10px;
max-width: 100%;
}
.form-group label {
text-align: left;
padding-left: 3px;
margin-bottom: 3px;
}
.buttons {
margin-top: 20px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<body>
<div class="containor">
<div class="row">
<div class="col-6 col-sm-12 col-md-6 border" id="login_section">
<form class="m-3" action="#" method="post">
<div class="form-group">
<h1 class="m-3 text-center">Welcome to Login Section!</h1>
<label>Email</label>
<input type="text" class="form-control" name="u_email">
<label>Password</label>
<input type="password" class="form-control" name="paswd">
<br>
<div class="buttons">
<button type="submit" class="btn btn-outline-info btn-block rounded-pill">Login</button>
<button type="rest" class="btn btn-outline-danger btn-block rounded-pill">Clear Credentials</button>
Fogot password!
</div>
</div>
</form>
</div>
<div class="col-right-6 col-sm-12 col-md-6 border" id="reg_section">
<form class="m-3" action="#" method="post">
<div class="form-group">
<h1 class="m-3 text-center">Don't have an Account yet!<br>Resgister In Here</h1>
<label>Email</label>
<input type="text" class="form-control" name="u_email">
<label>Password</label>
<input type="password" class="form-control" name="paswd">
<label>Confirm Password</label>
<input type="password" class="form-control" name="confirm_paswd">
<br>
<div class="buttons">
<button type="submit" class="btn btn-outline-success btn-block rounded-pill">Registor</button>
<button type="rest" class="btn btn-outline-danger btn-block rounded-pill">Clear Info</button>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
I would like to have bootstrap spinner that is on top of the form (it overlays form). However, the only thing I was able to get is to overlay the whole page. I am using Bootstrap.
<style>
.overlay {
position: fixed;
width: 100%;
height: 100%;
z-index: 1000;
top: 40%;
left: 0px;
opacity: 0.5;
filter: alpha(opacity=50);
}
</style>
<div class="overlay" id="loading" >
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status" >
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
<form method="post">
<div class="form-group">
<label for="num">Enter number <span>?</span></label>
<input id="num" type="text" class="form-control"/>
</div>
<button type="submit" class="btn btn-primary">Check </button>
</form>
U should put the spinner inside your form like this
<form method="post">
<div class="overlay" id="loading" >
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status" >
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
<fieldset disabled>
<div class="form-group">
<label for="num">Enter number <span>?</span></label>
<input id="num" type="text" class="form-control"/>
</div>
<button type="submit" class="btn btn-primary">Check </button>
</fieldset>
</form>
then give the spinner an absolute position
form {
position: relative;
border: 1px solid red
}
.overlay {
position: absolute;
top: 50%;
left: 50%;
opacity: 0.5;
transform: translate(-50%, -50%);
}
Following is the HTML content inside <body> tag
<div class="container mt-5 pt-2 pb-4" id="container-primary">
<div class="container mt-3" id="container-secondary"><h3>Welcome</h3><br> Please Enter your <strong>Password</strong> to view the question</br>
</div>
<div class="container pt-2" id="container-tertiary">
<form method="post" id="pwd-form" autocomplete="off">
<input type="password" class="form-control mx-auto" id="pwd" placeholder="Password" name="pwd" spellcheck="false"></input>
<div class="container" id="pwd-error-container"><?php
session_start();
if (isset($_SESSION['wrongpwd'])){
echo $_SESSION['wrongpwd'];
unset($_SESSION['wrongpwd']);
} ?>
</div>
<div class="container mx-auto" id="button-container">
<input type="submit" class="btn btn-info float-left" id="forgotpwd" value="Forgot Password">
<input type="button" class="btn btn-info float-right" id="submit-button" value="Validate" disabled>
</div>
</form>
There are two buttons inside the <form>. But when I inspect the webpage in the browser, I observed that those two buttons are not inside the <form>. What actually is causing the problem?
Following is the css:
#container-primary{
background-color: ;
}
#container-secondary{
background-color: ;
text-align: center;
}
#container-tertiary{
background-color: ;
text-align: center;
margin-top: 30px;
}
#pwd-form{
background-color: green;
}
#pwd{
width: 40%;
min-width: 300px;
font-size: 18px;
padding-top: 1px;
padding-bottom: 1px;
}
#pwd-error-container{
background-color: ;
font-size: 19px;
color: rgb(217, 48, 37);
font-weight: bold;
}
#button-container{
margin-top: 25px;
width: 40%;
min-width: 300px;
margin-bottom: 25px;
}
#question-form{
opacity: 0.3;
}
#answer{
width: 40%;
min-width: 300px;
font-size: 18px;
padding-top: 1px;
padding-bottom: 1px;
margin-top: 5%;
}
</style>```
I don't know where I have gone wrong. Screenshots of the inspection have been given in the comments section.
Remove your float-left and float-right classes from button.Then it work fine.
<div class="container" id="button-container">
<div class="row">
<div class="mr-auto">
<button type="submit" class="btn btn-info" id="forgotpwd">Forgot Password</button>
</div>
<div class="">
<button type="button" class="btn btn-info" id="submit-button" disabled>Validate</button>
</div>
</div>
</div>
https://jsfiddle.net/Lebxp70k/44/
your html code is invalid. You have closing tags where none are required and you are missing other closing tags that are required. Here's a corrected version
#container-primary{
background-color: ;
}
#container-secondary{
background-color: ;
text-align: center;
}
#container-tertiary{
background-color: ;
text-align: center;
margin-top: 30px;
}
#pwd-form{
background-color: green;
}
#pwd{
width: 40%;
min-width: 300px;
font-size: 18px;
padding-top: 1px;
padding-bottom: 1px;
}
#pwd-error-container{
background-color: ;
font-size: 19px;
color: rgb(217, 48, 37);
font-weight: bold;
}
#button-container{
margin-top: 25px;
width: 40%;
min-width: 300px;
margin-bottom: 25px;
}
#question-form{
opacity: 0.3;
}
#answer{
width: 40%;
min-width: 300px;
font-size: 18px;
padding-top: 1px;
padding-bottom: 1px;
margin-top: 5%;
}
<div class="container mt-5 pt-2 pb-4" id="container-primary">
<div class="container mt-3" id="container-secondary">
<h3>Welcome</h3><br>
Please Enter your <strong>Password</strong> to view the question<br>
</div>
<div class="container pt-2" id="container-tertiary">
<form method="post" id="pwd-form" autocomplete="off">
<input type="password" class="form-control mx-auto" id="pwd" placeholder="Password" name="pwd" spellcheck="false">
<div class="container" id="pwd-error-container"><?php
session_start();
if (isset($_SESSION['wrongpwd'])){
echo $_SESSION['wrongpwd'];
unset($_SESSION['wrongpwd']);
} ?>
</div>
<div class="container mx-auto" id="button-container">
<input type="submit" class="btn btn-info float-left" id="forgotpwd" value="Forgot Password">
<input type="button" class="btn btn-info float-right" id="submit-button" value="Validate" disabled>
</div>
</form>
</div>
</div>
here's your html. You can clearly see in the snippet that the form tag is in red i.e. it's not closed. The problem is both your < /br > and your < /input > tags. < /br > should just be < br > and < input > tags do not get closed with < / input >
<div class="container mt-5 pt-2 pb-4" id="container-primary">
<div class="container mt-3" id="container-secondary"><h3>Welcome</h3><br> Please Enter your <strong>Password</strong> to view the question</br>
</div>
<div class="container pt-2" id="container-tertiary">
<form method="post" id="pwd-form" autocomplete="off">
<input type="password" class="form-control mx-auto" id="pwd" placeholder="Password" name="pwd" spellcheck="false"></input>
<div class="container" id="pwd-error-container"><?php
session_start();
if (isset($_SESSION['wrongpwd'])){
echo $_SESSION['wrongpwd'];
unset($_SESSION['wrongpwd']);
} ?>
</div>
<div class="container mx-auto" id="button-container">
<input type="submit" class="btn btn-info float-left" id="forgotpwd" value="Forgot Password">
<input type="button" class="btn btn-info float-right" id="submit-button" value="Validate" disabled>
</div>
</form>
I want Something Like this and how can I achieve this task:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<form>
<div class="col-lg-10 mb-3">
<div class="input-group">
<input type="text" class="form-control rounded-0" id="validationDefaultUsername" placeholder="Username" aria-describedby="inputGroupPrepend2" required>
<div class="input-group-prepend">
<input type="submit" vlaue="submit" class="btn btn-primary btn-sm rounded-0" id="inputGroupPrepend2">
</div>
</div>
</div>
</form>
add to this css
.mycustom {
border: solid 1px green;
position: relative;
}
.mycustom input[type=text] {
border: none;
width: 100%;
padding-right: 123px;
}
.mycustom .input-group-prepend {
position: absolute;
right: 4px;
top: 4px;
bottom: 4px;z-index:9;
}
with one css mycustom class in your input-group class
like this
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"><style>.mycustom {
border: solid 1px green;
position: relative;
}
.mycustom input[type=text] {
border: none;
width: 100%;
padding-right: 123px;
}
.mycustom .input-group-prepend {
position: absolute;
right: 4px;
top: 4px;
bottom: 4px;z-index:9;
}</style>
<form>
<div class="col-lg-10 mb-3">
<div class="input-group mycustom">
<input type="text" class="form-control rounded-0" id="validationDefaultUsername" placeholder="Username" aria-describedby="inputGroupPrepend2" required>
<div class="input-group-prepend">
<input type="submit" vlaue="submit" class="btn btn-primary btn-sm rounded-0" id="inputGroupPrepend2">
</div>
</div>
</div>
</form>
Just make the .input-group-prepend class position:absolute
To prevent overriding the bootstrap styles rename the .input-group-prepend to some other name
.input-group-prepend {
position: absolute;
right: 6px;
top: 50%;
transform: translateY(-50%);
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<form>
<div class="col-lg-10 mb-3">
<div class="input-group">
<input type="text" class="form-control rounded-0" id="validationDefaultUsername" placeholder="Username" aria-describedby="inputGroupPrepend2" required>
<div class="input-group-prepend">
<input type="submit" vlaue="submit" class="btn btn-primary btn-sm rounded-0" id="inputGroupPrepend2">
</div>
</div>
</div>
</form>
see this bootstrap's documentation http://getbootstrap.com/components/#input-groups:
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<i class="fa fa-search"></i>
</button>
</span>
</div>
I am trying to upgrade this multi step form so the back and next buttons sit in the footer of this modal. How do I go about moving them there? (i.e. the next button in RED) - It doesn't work clicking this.
Thank you
$(document).ready(function() {
var navListItems = $('div.setup-panel div a'),
allWells = $('.setup-content'),
allNextBtn = $('.nextBtn'),
allPrevBtn = $('.prevBtn');
allWells.hide();
navListItems.click(function(e) {
e.preventDefault();
var $target = $($(this).attr('href')),
$item = $(this);
if (!$item.hasClass('disabled')) {
navListItems.removeClass('btn-primary').addClass('btn-default');
$item.addClass('btn-primary');
allWells.hide();
$target.show();
$target.find('input:eq(0)').focus();
}
});
allPrevBtn.click(function() {
var curStep = $(this).closest(".setup-content"),
curStepBtn = curStep.attr("id"),
prevStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().prev().children("a");
prevStepWizard.trigger('click');
});
allNextBtn.click(function() {
var curStep = $(this).closest(".setup-content"),
curStepBtn = curStep.attr("id"),
nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),
curInputs = curStep.find("input[type='text'],input[type='url']"),
isValid = true;
$(".form-group").removeClass("has-error");
for (var i = 0; i < curInputs.length; i++) {
if (!curInputs[i].validity.valid) {
isValid = false;
$(curInputs[i]).closest(".form-group").addClass("has-error");
}
}
if (isValid)
nextStepWizard.removeAttr('disabled').trigger('click');
});
$('div.setup-panel div a.btn-primary').trigger('click');
});
body {
margin-top: 40px;
}
.stepwizard-step p {
margin-top: 10px;
}
.stepwizard-row {
display: table-row;
}
.stepwizard {
display: table;
width: 90%;
position: relative;
}
.stepwizard-step button[disabled] {
opacity: 1 !important;
filter: alpha(opacity=100) !important;
}
.stepwizard-row:before {
top: 14px;
bottom: 0;
position: absolute;
content: " ";
width: 100%;
height: 1px;
background-color: #ccc;
z-order: 0;
}
.stepwizard-step {
display: table-cell;
text-align: center;
position: relative;
}
.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}
.modal-body {
max-height: calc(100vh - 210px);
overflow-y: auto;
}
.modal-dialog {
min-width: 70%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="stepwizard">
<div class="stepwizard-row setup-panel">
<div class="stepwizard-step">
1
<p>Student Details</p>
</div>
<div class="stepwizard-step">
2
<p>Student Medical</p>
</div>
<div class="stepwizard-step">
3
<p>Primary Contact</p>
</div>
<div class="stepwizard-step">
4
<p>Secondary Contact</p>
</div>
<div class="stepwizard-step">
5
<p>Review & Submit</p>
</div>
</div>
</div>
</div>
<div class="modal-body">
<div class="container" style="width:100%;">
<form role="form" action="" method="post">
<div class="row setup-content" id="step-1">
<div class="col-md-6 col-md-offset-3">
<div class="col-md-12">
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
<h3> Step 1</h3>
<div class="form-group">
<label class="control-label">First Name</label>
<input maxlength="100" required="required" class="form-control" placeholder="Enter First Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Last Name</label>
<input maxlength="100" required="required" class="form-control" placeholder="Enter Last Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Address</label>
<textarea required="required" class="form-control" placeholder="Enter your address"></textarea>
</div>
</div>
</div>
</div>
<div class="row setup-content" id="step-2">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 2</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-3">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 3</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-4">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 4</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-5">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 5</h3>
<button class="btn btn-primary prevBtn btn-lg pull-left" type="button">Back</button>
<button class="btn btn-success btn-lg pull-right" type="submit">Submit</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
<button class="btn btn-primary prevBtn btn-lg pull-left" type="button">Back</button>
<button style="color:red;" class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
Now your prev and next buttons are working
$(document).ready(function () {
var navListItems = $('div.setup-panel div a'),
allWells = $('.setup-content'),
allNextBtn = $('.nextBtn'),
allPrevBtn = $('.prevBtn');
allWells.hide();
navListItems.click(function (e) {
e.preventDefault();
var $target = $($(this).attr('href')),
$item = $(this);
if (!$item.hasClass('disabled')) {
navListItems.removeClass('btn-primary').addClass('btn-default');
$item.addClass('btn-primary');
allWells.hide();
$target.show();
$target.find('input:eq(0)').focus();
}
});
allPrevBtn.click(function(){
var setupwizard = $('.stepwizard-row');
var sel = setupwizard.find('.btn-primary');
var to_sel = sel.parent().prev().find('.btn-circle');
to_sel.trigger('click');
/* DISABLING AND ENABLING PREV AND NEXT
BUTTONS BASED ON CURRENT PAGE
*/
if(to_sel.hasClass('start-class'))
{
$('.prevBtn').addClass('disabled-control');
$('.nextBtn').removeClass('disabled-control');
}
else if(to_sel.hasClass('end-class'))
{
$('.nextBtn').addClass('disabled-control');
$('.prevBtn').removeClass('disabled-control');
}
else
{
$('.nextBtn').removeClass('disabled-control');
$('.prevBtn').removeClass('disabled-control');
}
});
$(document).on('click', '.nextBtn', function(){
var setupwizard = $('.stepwizard-row');
var sel = setupwizard.find('.btn-primary');
var to_sel = sel.parent().next().find('.btn-circle');
var err = 0;
var step = get_current_page_id();
/* CHECKING IF ALL INPUTS AND TEXTAREA IN THE CURRENT
PAGE ARE FILLED. IF NOT : ADD ERROR CLASS ON INPUT
AND INCREMENT ERROR COUNTER */
$('#' + step + ' input, textarea').each(function(){
if($(this).val() == '')
{
if(!$(this).hasClass('error-class'))
$(this).addClass('error-class')
err++;
}
else
{
if($(this).hasClass('error-class'))
$(this).removeClass('error-class')
}
});
/* IF ERROR COUNTER == 0 ( ie. NO ERRORS FOUND )
=> PROCEED TO NEXT STEP
*/
if(err == 0)
{
to_sel.trigger('click');
if(to_sel.hasClass('start-class'))
{
$('.prevBtn').addClass('disabled-control');
$('.nextBtn').removeClass('disabled-control');
}
else if(to_sel.hasClass('end-class'))
{
$('.nextBtn').addClass('disabled-control');
$('.prevBtn').removeClass('disabled-control');
}
else
{
$('.nextBtn').removeClass('disabled-control');
$('.prevBtn').removeClass('disabled-control');
}
}
});
/* SHOW AND HIDE ERROR CLASS AS USER TYPES */
$(document).on('input', 'input, textarea', function(){
if($(this).val() == '')
{
if(!$(this).hasClass('error-class'))
$(this).addClass('error-class');
}
else
{
if($(this).hasClass('error-class'))
$(this).removeClass('error-class')
}
});
/* FUNCTION WHICH RETURNS THE ID OF CURRENT VISIBLE PAGE */
function get_current_page_id()
{
return $(".setup-content:visible").attr('id');
}
$('div.setup-panel div a.btn-primary').trigger('click');
});
body {
margin-top:40px;
}
.stepwizard-step p {
margin-top: 10px;
}
.stepwizard-row {
display: table-row;
}
.stepwizard {
display: table;
width: 90%;
position: relative;
}
.stepwizard-step button[disabled] {
opacity: 1 !important;
filter: alpha(opacity=100) !important;
}
.stepwizard-row:before {
top: 14px;
bottom: 0;
position: absolute;
content: " ";
width: 100%;
height: 1px;
background-color: #ccc;
z-order: 0;
}
.stepwizard-step {
display: table-cell;
text-align: center;
position: relative;
}
.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}
.modal-body {
max-height: calc(100vh - 210px);
overflow-y: auto;
}
.disabled-control{
opacity: 0.4;
cursor: not-allowed;
pointer-events: none;
}
.modal-dialog {
min-width: 70%;
}
.error-class{
border: 1px solid red !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="stepwizard">
<div class="stepwizard-row setup-panel">
<div class="stepwizard-step">
1
<p>Student Details</p>
</div>
<div class="stepwizard-step">
2
<p>Student Medical</p>
</div>
<div class="stepwizard-step">
3
<p>Primary Contact</p>
</div>
<div class="stepwizard-step">
4
<p>Secondary Contact</p>
</div>
<div class="stepwizard-step">
5
<p>Review & Submit</p>
</div>
</div>
</div>
</div>
<div class="modal-body">
<div class="container" style="width:100%;">
<form role="form" action="" method="post">
<div class="row setup-content" id="step-1">
<div class="col-md-6 col-md-offset-3">
<div class="col-md-12">
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button><h3> Step 1</h3>
<div class="form-group">
<label class="control-label">First Name</label>
<input maxlength="100" required="required" class="form-control" placeholder="Enter First Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Last Name</label>
<input maxlength="100" required="required" class="form-control" placeholder="Enter Last Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Address</label>
<textarea required="required" class="form-control" placeholder="Enter your address"></textarea>
</div>
</div>
</div>
</div>
<div class="row setup-content" id="step-2">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 2</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left disabled-control" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-3">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 3</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left disabled-control" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-4">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 4</h3>
<div class="form-group">
<label class="control-label">Company Name</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Name" type="text">
</div>
<div class="form-group">
<label class="control-label">Company Address</label>
<input maxlength="200" required="required" class="form-control" placeholder="Enter Company Address" type="text">
</div>
<button class="btn btn-primary prevBtn btn-lg pull-left disabled-control" type="button">Back</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-5">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3> Step 5</h3>
<button class="btn btn-primary prevBtn btn-lg pull-left disabled-control" type="button">Back</button>
<button class="btn btn-success btn-lg pull-right" type="submit">Submit</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
<button class="btn btn-primary prevBtn btn-lg pull-left disabled-control" type="button">Back</button>
<button style="color:red;" class="btn btn-primary nextBtn btn-lg pull-right" type="button">Next</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->