Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Payment form with total preview"
Bootstrap 3.1.0 Snippet by
detain
3.1.0
jQuery
Preview
HTML
JS
View Full Screen
Forked from
Fork
Fork this
Parent
623
 
1 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.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-sm-12"> <legend>Filiais:</legend> </div> <!-- panel preview --> <div class="col-sm-5"> <h4>Adicione Filial:</h4> <div class="panel-body form-horizontal payment-form"> <div class="form-group"> <label for="status" class="col-sm-3 control-label">Status</label> <div class="col-sm-9"> <select class="form-control" id="status" name="status"> <option>Selecione: </option> <option>Filial 0101 - Matriz</option> <option>Filial 0102 - Recife</option> <option>Filial 0103 - Olindina</option> <option>Filial 0104 - Abaetetuba</option> </select> </div> </div> <div class="form-group"> <div class="col-sm-12 text-right"> <button type="button" class="btn btn-default preview-add-button"> <span class="glyphicon glyphicon-plus"></span> Add </button> </div> </div> </div> </div> <!-- / panel preview --> <div class="col-sm-7"> <h4>Preview:</h4> <div class="row"> <div class="col-xs-12"> <div class="table-responsive"> <table class="table preview-table"> <thead> <tr> <th>Filiais</th> </tr> </thead> <tbody></tbody> <!-- preview content goes here--> </table> </div> </div> </div> <div class="row text-right"> <div class="col-xs-12"> <h4>Total: <strong><span class="preview-total"></span></strong></h4> </div> </div> </div> </div> </div>
function calc_total(){ var sum = 0; $('.input-amount').each(function(){ sum += parseFloat($(this).text()); }); $(".preview-total").text(sum); } $(document).on('click', '.input-remove-row', function(){ var tr = $(this).closest('tr'); tr.fadeOut(200, function(){ tr.remove(); calc_total() }); }); $(function(){ $('.preview-add-button').click(function(){ var form_data = {}; form_data["concept"] = $('.payment-form input[name="concept"]').val(); form_data["description"] = $('.payment-form input[name="description"]').val(); form_data["amount"] = parseFloat($('.payment-form input[name="amount"]').val()).toFixed(2); form_data["status"] = $('.payment-form #status option:selected').text(); form_data["date"] = $('.payment-form input[name="date"]').val(); form_data["remove-row"] = '<span class="glyphicon glyphicon-remove"></span>'; var row = $('<tr></tr>'); $.each(form_data, function( type, value ) { $('<td class="input-'+type+'"></td>').html(value).appendTo(row); }); $('.preview-table > tbody:last').append(row); calc_total(); }); });
Related:
See More
Free Template
Paper Dashboard
462.7K
45
login-form
170.6K
18
Login Form
142.0K
51
Contact Form
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76