"Modal Usage for Bootstrap Forms"
Bootstrap 3.3.0 Snippet by ashutosh123

<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"> <!--========== First Modal ==========--> <article class="col-md-4 well"> <h3 class="page-header text-center">Start Quiz Now<br /> <small>multiple choice question modal</small> </h3> <br><hr> <div class="text-center"> <a class="btn btn-success" href="#successModal" data-toggle="modal"><i class="glyphicon glyphicon-eye-open"></i> Start Quiz</a> </div> <!-- Modal --> <div class="modal fade" id="successModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-success"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">[ × ]</button> <h2><i class="glyphicon glyphicon-cloud"></i>   Do you feel like a cloud?</h2> </div> <div class="modal-body"> <div class="col-md-12 radio-choices"> <div class="col-md-6 col-xs-6 radio-left"> <form role="form"> <div class="radio"> <label><input type="radio" name="opta">Option 1</label> </div> <div class="radio"> <label><input type="radio" name="optb">Option 2</label> </div> <div class="radio"> <label><input type="radio" name="optc">Option 3</label> </div> <div class="radio"> <label><input type="radio" name="optd">Option 3</label> </div> </form> </div> <div class="col-md-6 col-xs-6 radio-right"> <div class="radio"> <label>Question goes here</label> </div> <div class="radio"> <label>Question goes here</label> </div> <div class="radio"> <label>Question goes here</label> </div> <div class="radio"> <label>Question goes here</label> </div> </div> </div><!-- ends col-12 --> </div><div class="clearfix"></div> <div class="modal-footer"> <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary pull-right" data-next="modal">Next</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </article> <!--========== Second Modal ==========--> <article class="col-md-4 well"> <h3 class="page-header text-center">Contact Form Modal<br /> <small>popup modal contact form</small> </h3> <br><hr> <div class="text-center"> <a class="btn btn-warning" href="#warningModal" data-toggle="modal"><i class="glyphicon glyphicon-briefcase"></i> Add Contact</a> </div> <!-- Modal --> <div class="modal fade" id="warningModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-warning"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h2><i class="glyphicon glyphicon-user"></i>   Add a New Contact</h2> </div> <div class="modal-body"> <div class="col-md-12 radio-choices"> <div class="col-md-6 col-xs-6 radio-left"> <form role="form" action=""> <div class="radio"> <label>First Name</label> </div> <div class="radio"> <label>Last Name</label> </div> <div class="radio"> <label>Phone</label> </div> <div class="radio"> <label>Email</label> </div> </div> <div class="col-md-6 col-xs-6 radio-right"> <div class="radio"> <input type="text" name="opta"> </div> <div class="radio"> <input type="text" name="optb"> </div> <div class="radio"> <input type="text" name="optc"> </div> <div class="radio"> <input type="text" name="optd"> </div> </form> </div> </div><!-- ends col-12 --> </div><div class="clearfix"></div> <div class="modal-footer"> <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary pull-right">Submit</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </article> <!--========== Third Modal ==========--> <article class="col-md-4 well"> <h3 class="page-header text-center">Shopping Cart Modal<br /> <small>popup shopping cart modal</small> </h3> <br><hr> <div class="text-center"> <a class="btn btn-primary" href="#primaryModal" data-toggle="modal"><i class="glyphicon glyphicon-shopping-cart"></i> Shopping Cart</a> </div> <!-- Modal --> <div class="modal fade" id="primaryModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-primary"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> [ × ] </button> <h2><i class="glyphicon glyphicon-shopping-cart"></i>   Shopping Cart Items</h2> </div> <div class="modal-body"> <div class="col-md-12"> <div class="table-responsive"> <form action="" method="" name=""> <table class="table table-condensed"><thead> <tr> <th>Category</th> <th>Product</th> <th>Price</th> <th>Quantity</th> <th>Subtotal</th> </tr></thead> <tbody> <tr> <td> <select name='optionsA'> <option value=''>option a</option><option value=''>option b</option><option value=''>option c</option> </select> </td> <td> <select name='products'> <option value=''>option a</option><option value=''>option b</option><option value=''>option c</option> </select> </td> <td> <input name="price" type="number" class="form-control" value='0.00'> </td> <td> <input name="" type="number" class="form-control" value='0'> </td> <td> <input name="" type="number" class="form-control" value='0.00'> </td> </tr> </tbody></table> <p class='grandTotal'>Total value: $<input name="" type="number" class="form-control" value='0.00'></p> <button data-bind='click: addLine'>Add product</button> <button data-bind='click: save'>Submit order</button> <a href='#' data-bind='click: $parent.removeLine'>Remove</a> </form> </div> </div><!-- ends col-12 --> </div><div class="clearfix"></div> <div class="modal-footer"> <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary pull-right" data-next="modal">Continue Shopping</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </article> </div> </div>
.modal-header-success { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #5cb85c; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-warning { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: orange; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-primary { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #112299; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } body{ font-family: 'Lato', sans-serif; background: #f7f7f4; } .text-center{ text-align: center; margin: 1.25rem 0; border-bottom: 1px solid #dadada; padding: 1.25rem 0; } .radio label input { font-size: 100%; } .radio-choices { font-size: 18px; } input[type='radio'] { width: auto; height: 1.4em; } .radio-choices .radio:nth-of-type(even) { background: #effafa; } .radio-choices .radio-left { margin-right: 0; padding-right: 0; } .radio-choices .radio-right { margin-left: 0; padding-left: 0; } /* media queries specific to alignment of forms not using form-group Bootstrap to save space so we compensate - some phones looked odd so check before deployment */ @media screen and (max-width: 540px) { .radio { margin-left: 1rem; font-size: 1.25rem; } .radio-choices .radio-left { float: left; margin-left: -10px; padding-left: 0; } .radio-choices .radio-right { float: right; margin-right: -10px; padding-right: 0; } }

Related: See More


Questions / Comments: