Bootstrap modal with horizontal form - css

I am trying to get a horizontal form inside of a bootstrap modal.
No matter what I try to do, the labels are above the form elements. I know it must be something simple, but I have tried everything I can think of.
This is what I have at the moment.
<div class="modal fade" id="newEventModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body form-horizontal">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="title" class="control-label col-sm-2">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title">
</div>
</div>
<div class="form-group">
<label for="end" class="control-label col-sm-2">End</label>
<div class="col-sm-10">
<div class='input-group date' id='datetimepickerend'>
<input type='text' class="form-control" id='end' />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<label for="allday" class="control-label col-sm-2">All day event</label>
<div class="col-sm-10">
<input type="checkbox" class="form-control" id="allday">
</div>
</div>
<div class="form-group">
<label for="description" class="control-label col-sm-2">Description</label>
<div class="col-sm-10">
<textarea class="form-control" id="description"></textarea>
</div>
</div>
<div class="form-group">
<label for="wwner" class="control-label col-sm-2">Owner</label>
<div class="col-sm-10">
<select name='owner'>
<option>Agent A</option>
<option>Agent B</option>
<option>Agent C</option>
<option>Agent D</option>
<option></option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
http://jsfiddle.net/1aeur58f/868/
Please help.

It's because of your window/screen size. You used .col-sm but you should use .col-xs as a basis because xs is for the smallest devices.
Always start with .col-xs and then if you require different functionality at a bigger device size (e.g. laptop) then you can introduce the other classes such as .col-sm or .col-md etc.
Bootstrap is mobile first. Whilst you used sm, chances are you were using a device that didn't fall into that category.
See here for more information on the Bootstrap grid classes.
jQuery(document).ready(function(e) {
jQuery('#mymodal').trigger('click');
});
<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.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Button trigger modal -->
<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body form-horizontal">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="title" class="control-label col-xs-2">Title</label>
<div class="col-xs-10">
<input type="text" class="form-control" id="title">
</div>
</div>
<div class="form-group">
<label for="start" class="control-label col-xs-2">Start</label>
<div class="col-xs-10">
<div class='input-group date' id='datetimepickerstart'>
<input type='text' class="form-control" id='start' />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<label for="end" class="control-label col-xs-2">End</label>
<div class="col-xs-10">
<div class='input-group date' id='datetimepickerend'>
<input type='text' class="form-control" id='end' />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<label for="allday" class="control-label col-xs-2">All day event</label>
<div class="col-xs-10">
<input type="checkbox" class="form-control" id="allday">
</div>
</div>
<div class="form-group">
<label for="timezone" class="control-label col-xs-2">Timezone</label>
<div class="col-xs-10">
<input type="text" class="form-control" id="timezone">
</div>
</div>
<div class="form-group">
<label for="repeat" class="control-label col-xs-2">Repeat</label>
<div class="col-xs-10">
<select name='repeat'>
<option>Never</option>
<option>Daily</option>
<option>Weekly</option>
<option>Monthly</option>
<option>Annually</option>
</select>
</div>
</div>
<div class="form-group">
<label for="description" class="control-label col-xs-2">Description</label>
<div class="col-xs-10">
<textarea class="form-control" id="description"></textarea>
</div>
</div>
<div class="form-group">
<label for="wwner" class="control-label col-xs-2">Owner</label>
<div class="col-xs-10">
<select name='owner'>
<option>Agent A</option>
<option>Agent B</option>
<option>Agent C</option>
<option>Agent D</option>
<option></option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>

Related

Button doesn't stay inside form "card"

I am trying to improve my Bootsrap skills but need help for an issue about card and forms.
Trying to fit form in card but couldn't make it. Has anyone an idea about this issue?
<div class="row row-content col-sm-8">
<div class="card">
<h3 class="card-header card-warning" style="width: 100%">Featured</h3>
<form class="form-group col-sm-12 row">
<div class="col col-md-3 col-sm-3">
<label><strong>Number of Guests</strong></label>
</div>
<div class="col col-md-9 col-sm-9 align-items-center">
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
</label>
</div>
<div class="col-xs-12 col-sm-3 align-items-center">
<p style="padding: 10px"></p>
<p><strong>Date and Time</strong></p>
</div>
<div class="col-sm-9 col-md-9 form-inline">
<label class="sr-only" for="inlineFormInput">Date</label>
<input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" id="inlineFormInput" placeholder="Date">
<label class="sr-only" for="inlineFormInputGroup">Time</label>
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="Time">
</div>
</div>
<div class="col-sm-3">
</div>
<div class="col col-offset">
<a class="btn btn-primary" href="#">Reserve</a>
</div>
</form>
</div>
</div>
Reserve button stays outside of card, why form doesn't fit to card here?
Button should be in card also..
I solved this problem as changing code like this.
<div class="row-content col-sm-8">
<div class="card">
<h3 class="card-header card-warning" style="width: 100%">Featured</h3>
<form class="col-sm-12 row">
<div class="col-xs-12 col-sm-3 align-items-center">
<label><strong>Number of Guests</strong></label>
</div>
<div class="col-sm-9 col-md-9 input-group">
<label class="radio-inline" style="padding-left:">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 2
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 3
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 4
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 5
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 6
</label>
</div>
<div class="col-xs-12 col-sm-3 align-items-center">
<p style="padding: 10px"></p>
<p><strong>Date and Time</strong></p>
</div>
<div class="col-sm-9 col-md-9 input-group align-items-center row">
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar-o fa-fw"></i></span></span>
<input type="text" class="form-control" aria-label="Date" placeholder="Date">
</div>
</div>
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-clock-o fa-fw"></i></span></span>
<input type="text" class="form-control" aria-label="Text input with radio button" placeholder="Time">
</div>
</div>
</div>
<div class="col-sm-3">
</div>
<div class="col col-offset">
<a class="btn btn-primary" href="#">Reserve</a>
</div>
</form>
</div>
</div>

Align Bootstrap form input fields across multiple rows inside a modal

Specifically, the problems are:
The first row wraps to a second line
The input fields do not line up vertically
It might be possible to use a table, but that might break responsiveness on mobile devices. Is there a clean/elegant way to align these input fields?
https://codepen.io/dtgq/pen/rwQRoK
For posterity, a copy of the HTML on the codepen:
<div class="modal fade" id="fjFilterModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Filter</h5>
<button type="button" class="close" data-dismiss="modal">
<span>×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<label class="col-form-label col-md-2">Cost</label>
<div class=col-md-10>
<div class="form-inline">
<div class="form-group mx-2">
<div class=input-group>
<span class=input-group-addon>$</span>
<input class=form-control name="max_cost-gte" type=number placeholder="Minimum" step=1 min=0>
<span class=input-group-addon>.00</span>
</div>
</div>
to
<div class="form-group mx-2">
<div class=input-group>
<span class=input-group-addon>$</span>
<input class=form-control name="min_cost-lte" type=number placeholder="Maximum" step=1 min=0>
<span class=input-group-addon>.00</span>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-2">Start date</label>
<div class=col-md-10>
<div class="form-inline">
<div class="form-group mx-2">
<input class="form-control" type="date" name="min_date-gte">
</div>
to
<div class="form-group mx-2">
<input class="form-control" type="date" name="min_date-lte">
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-2">Available units</label>
<div class=col-md-10>
<div class="form-inline">
<div class="form-group mx-2">
<div class=input-group>
<input class=form-control name="sum_vacant-gte" type=number min=0 placeholder="Minimum">
<span class=input-group-addon>units</span>
</div>
</div>
to
<div class="form-group mx-2">
<div class=input-group>
<input class=form-control name="sum_vacant-lte" type=number min=0 placeholder="Maximum">
<span class=input-group-addon>units</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<button type="button" class="btn" data-toggle="modal" data-target="#fjFilterModal">
Filter
</button>

CSS Bootstrap 3.0 field with icon

I have a form with 3 fields, two of them are for entering dates. I was requested to add an icon to the very end of the field.
This is the result:
If you see the field that has the icon expands beyonds the other fields to the left and right so it looks pretty ugly.
This is the code:
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="input-group col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button>
</div>
</div>
</div>
Any clue on how to do it right?
Here is your fixed code please copy it and paste it
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="col-md-8">
<div class="input-group ">
<input type="text" class="form-control" placeholder="mm/dd/yyyy">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div></div>
</div><div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button></div></div></div>
I have tested it works fine. Cheers!
Some CSS is messing with you.
Your line with input-group col-md-8 is apparently malfunctioning.
I made an example:
https://plnkr.co/edit/gxpaP4wR8cZzb3E4CvtR
Check if you have some custom CSS that is overriding bootstraps'.
Use my code this is working fine.
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button>
</div>
</div>
</div>

My Bootstrap form modal form doesn't display properly

I am trying to add a modal editing form to a page using Bootstrap. The idea is that when the user picks an item from the grid, an editing form should pop up showing current values and allowing them to make changes. Here's the code for the modal form:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="form-horizontal" id="myForm" role="form">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">My modal</h4>
</div>
<div class="modal-body">
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbTitle">Public Title:</label>
<div class="input-group col-sm-5">
<input type="text" runat="server" class="form-control required" id="tbTitle">
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbInternalTitle">Internal Title:</label>
<div class="input-group col-sm-5">
<input type="text" runat="server" class="form-control required" id="tbInternalTitle">
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbPrice">Monthly Price:</label>
<div class="input-group col-sm-5">
<input type="text" runat="server" class="form-control required" id="tbPrice">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
Now, the thing is, when I click the "Edit" button on a row in the GridView control on the page, it does what it should - it retrieves the plan data and populates the form fields. I know this, because if I examine the page source after clicking an item, here's what I see in the HTML:
<div class="container-fluid page-top">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="form-horizontal" id="myForm" role="form">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">My modal</h4>
</div>
<div class="modal-body">
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbTitle">Public Title:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbTitle" type="text" id="cpMain_tbTitle" class="form-control required" value="Basic Gold Program" />
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbInternalTitle">Internal Title:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbInternalTitle" type="text" id="cpMain_tbInternalTitle" class="form-control required" value="BASEPLAN" />
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbPrice">Monthly Price:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbPrice" type="text" id="cpMain_tbPrice" class="form-control required" value="$75.00" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
However, when viewing the page normally and clicking the "Edit" button for a row, here's a screenshot of what actually appears:
I odn't know why the form data itself doesn't show up, but it's driving me nuts! I don't seem to have any HTML errors (unclosed tags, etc.), so I can't track down what's happening here. Any help?
I put your code into a snippet and it works... odd.
If you can see a correct HTML in the browser's console then maybe it's a css problem.
You should try to set a height property to be sure...
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container-fluid page-top">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="modal fade" id="myModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="form-horizontal" id="myForm" role="form">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">My modal</h4>
</div>
<div class="modal-body">
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbTitle">Public Title:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbTitle" type="text" id="cpMain_tbTitle" class="form-control required" value="Basic Gold Program" />
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbInternalTitle">Internal Title:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbInternalTitle" type="text" id="cpMain_tbInternalTitle" class="form-control required" value="BASEPLAN" />
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-lg-12">
<label class="control-label col-sm-3" for="tbPrice">Monthly Price:</label>
<div class="input-group col-sm-5">
<input name="ctl00$cpMain$tbPrice" type="text" id="cpMain_tbPrice" class="form-control required" value="$75.00" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
Well, the issue was how I was calling the modal form to open. I had to use a different JavaScript function to invoke it, since the other one worked but was buggy in some way. The Javascript function is:
function openModal() {
$('#myModal').modal('show');
}
and it's called from the server side with this:
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
The other one I was using didn't quite get it right, although the modal still appeared. Weird, but it worked. Thanks for the feedback, guys!

Bootstrap Modal Open Different Section Of Modal

Consider the following:
I have 2 buttons a Login btn and a Registration Button. When either one of the buttons are clicked a bootstrap modal comes up, with 2 tabs, one for login and one for registration.
My Problem
Regardless if login button or registration button is clicked the modal always opens on the login tab, if user clicks register button I would like the modal to open on the registration tab.
JSFIDDLE LINK, CLICK HERE
Here is a visual example:
Two Buttons, user clicks button Bootstrap Modal Opens
Bootstrap Modal opens on login tab, section
If user clicks Register Button the Modal still opens on the login tab section, I would like this to change, so modal opens on registration tab when register button is clicked
Code Buttons:
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-62 col-xs-6">
<button type="button" data-toggle="modal" data-target="#myModal" style="cursor:pointer" id="loginBtn">Login</button>
</div><!--Columns-->
<div class="col-lg-6 col-md-6 col-sm-62 col-xs-6">
<!-- I BELIEVE THE PROBLEM IS HERE-->
<button type="button" data-toggle="modal" data-target="#myModal#registration" style="cursor:pointer" id="regBtn">Register</button>
</div><!--Columns-->
</div><!--Row-->
Modal Code
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h4 class="modal-title" id="myModalLabel">
Login/Registration
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8" style="border-right: 1px dotted #C2C2C2;padding-right: 30px;">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active">Login</li>
<li>Registration</li>
</ul>
<!-- Tab panes -->
<!--LOGIN TAB -->
<div class="tab-content">
<div class="tab-pane active" id="Login">
<form class="form-horizontal" role="form" method="post" id="tabLogin" action="includes/loginScript.php">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<span id="email-info"></span>
<div class="col-sm-10">
<input type="email" name="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<span id="pwd-info"></span>
<div class="col-sm-10">
<input type="password" name="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
<!-- <span style="color:red;">Forgot Password</span>-->
</form>
<div id="tabloginMsg"></div>
<!--**********END LOGIN TAB*************** -->
</div>
<!--*************START REGISTRATION************************* -->
<div class="tab-pane" id="Registration">
<form name="regForm" class="form-horizontal" role="form" id="regTab" action="includes/classes/class.userRegistration.php" method="post">
<div class="form-group">
<label class="control-label col-sm-2" for="regName">Name:</label>
<div class="col-sm-10">
<input type="text" name="userName" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regLastName">Surname:</label>
<div class="col-sm-10">
<input type="text" name="userSurname" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regEmail">Email:</label>
<div class="col-sm-10">
<input type="email" name="userEmail" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regPword">Password:</label>
<div class="col-sm-10">
<input type="password" name="pword1" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="confRegPword">Confirm Password:</label>
<div class="col-sm-10">
<input type="password" name="pword2" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regPhone">Phone:</label>
<div class="col-sm-10">
<input type="text" name="userPhone" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<button name="submit" class="btn btn-danger" style="font-size:19px" >Register</button>
</div>
</div>
</form>
<div id="tabregMsg"></div>
</div>
</div>
<div id="OR" class="hidden-xs">
OR</div>
</div>
<div class="col-md-4">
<div class="row text-center sign-with">
<div class="col-md-12">
<h4>
Sign in with</h4>
</div>
<div class="col-md-12">
<div class="btn-group btn-group-justified">
Facebook
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
You can use jquery to get this approach
simply change your css code for TAB to
<ul class="nav nav-tabs">
<li id="loginLi">Login</li>
<li id="RegLi">Registration</li>
</ul>
then add this jQuery click action :
$("#loginBtn").on('click',function(){
$('#RegLi').removeClass('active');
$('#loginLi').addClass('active');
})
$("#regBtn").on('click',function(){
$('#loginLi').removeClass('active');
$('#RegLi').addClass('active');
})
you may improve this code but it's the idea to select the proper tabs.
see the demo here : https://jsfiddle.net/j4pkru1a/

Resources