vladkras

for http://microplugins.blogspot.com/2013/09/calc-20.html

Sep 9th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.58 KB | None | 0 0
  1.       $(document).ready(function() {
  2.         $('select.example1, input.example1').change(function() {
  3.             console.log($(this).val());
  4.             countExample1();
  5.         });
  6.         $('button.example1').click(function() {
  7.             countExample1();
  8.         });
  9.         function countExample1() {
  10.             var total = 0;
  11.             $('select.example1').each(function() {
  12.                 total += parseFloat($(this).val());
  13.             });
  14.             if ($('input.example1').is(':checked')) total += 1;
  15.             $('div.example1').html('Total: '+total);
  16.         }
  17.       });
Add Comment
Please, Sign In to add comment