Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function () {
- function iDoMathsGood() {
- $('.amount').map(function () {
- // get all of the elements we'll need to manipulate
- var row = $(this).parent().parent();
- var originalTtl = row.find('.price');
- var adjusted = row.find('.adj_ct');
- // get the numbers we'll need and do some math
- var cts = Number(row.find('.weight').html());
- var origPPCT = Number(row.find('.org_ct').html()) * 1000;
- var markupPrct = Number($('#markup').val()) / 100;
- var markedupCost = (origPPCT * markupPrct) + origPPCT;
- // do a little more math them set the results
- adjusted.html((markedupCost / 1000).toFixed(2));
- originalTtl.html(((origPPCT * cts) / 1000).toFixed(2));
- return $(this).html(((markedupCost * cts) / 1000).toFixed(2));
- });
- }
- iDoMathsGood();
- $('#markup').keyup(function () {
- iDoMathsGood();
- });
- //button to reset input values
- $("#btn").click(function(){
- /* Single line Reset function executes on click of Reset Button */
- $("#form")[0].reset();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement