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
"plame"
Bootstrap 4.1.1 Snippet by
luchonia
4.1.1
jQuery
Preview
HTML
JS
View Full Screen
Forked from
Fork
Fork this
Parent
706
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <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 clearfix"> <div class="col-md-12"> <table class="table table-bordered table-hover" id="tab_logic"> <thead> <tr> <th class="text-center"> # </th> <th class="text-center"> SPP </th> <th class="text-center"> BASICO </th> <th class="text-center"> ESSALUD ONP 10% </th> <th class="text-center"> PRIMA AFP (NO ES ONP 12%) </th> </tr> </thead> <tbody> <tr id='addr0'> <td class="text-center">1</td> <td class="text-center"><select id="combobox" name='afp[]' class="center afp"> <option value="-1" step="0" min="0">#</option> <option value="0" step="0" min="0">HORIZONTE</option> <option value="0" step="0" min="0">PROFUTURO</option> <option value="1" step="0" min="0">ONP</option> </select> </td> <td><input type="number" name='basico[]' class="form-control basico" step="0" min="0"/></td> <td><input type="number" name='essalud[]' placeholder='0.00' class="form-control essalud" readonly/></td> <td><input type="number" name='total[]' placeholder='0.00' class="form-control total" readonly/></td> </tr> <tr id='addr1'></tr> </tbody> </table> </div> </div> <div class="row clearfix"> <div class="col-md-12"> <button id="add_row" class="btn btn-default pull-left">Add Row</button> <button id='delete_row' class="pull-right btn btn-default">Delete Row</button> </div> </div> <div class="row clearfix" style="margin-top:20px"> <div class="pull-right col-md-4"> <table class="table table-bordered table-hover" id="tab_logic_total"> <tbody> </tbody> </table> </div> </div> </div>
$(document).ready(function(){ var i=1; $("#add_row").click(function(){b=i-1; $('#addr'+i).html($('#addr'+b).html()).find('td:first-child').html(i+1); $('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>'); i++; }); $("#delete_row").click(function(){ if(i>1){ $("#addr"+(i-1)).html(''); i--; } }); $('#tab_logic tbody tr').on('keyup change',function(){ if($(this).find('.afp').val()==1){ calcOnp(); }else if($(this).find('.afp').val()==0){ calcFp(); }else{ } }); }); function calcOnp() { $('#tab_logic tbody tr').each(function(i, element) { var html = $(this).html(); if(html!='') { var qty = $(this).find('.basico').val(); $(this).find('.total').val(qty*0.0); $(this).find('.essalud').val(qty*0.1); } }); } function calcFp() { $('#tab_logic tbody tr').each(function(i, element) { var html = $(this).html(); if(html!='') { var qty = $(this).find('.basico').val(); $(this).find('.essalud').val(qty*0.0); $(this).find('.total').val(qty*0.12); } }); }
Related:
See More
Free Template
Coming Sssoon Page
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76