Including Exponents in jQuery?
问题 How do you implement exponents in JQuery? I'm modifying this: $.fn.sumValues = function() { var sum = 0; this.each(function() { if ( $(this).is(':input') ) { var val = $(this).val(); } else { var val = $(this).text(); } sum += parseFloat( ('0' + val).replace(/[^0-9-\.]/g, ''), 10 ); }); return sum; and $(document).ready(function() { $('input.price').bind('keyup', function() { $('span.total').html( $('input.price').sumValues() ); }); to calculate a more complex formula of summations from user