Created
March 16, 2016 06:23
-
-
Save 1990prashant/1633a7abf238472e1edb to your computer and use it in GitHub Desktop.
To write prototype js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mashkar = { | |
init: function() { | |
this.calculateTotalPrice(); | |
}, | |
calculateTotalPrice: function() { | |
$(document).on("change", '.price-field', function() { | |
var variantRow = $(this).closest(".variant-row"); | |
var sellerPrice = parseFloat($(this).val()); | |
var basePrice = parseFloat(variantRow.find(".base-price").data("base_price")); | |
variantRow.find(".final-price").text((sellerPrice + basePrice).toFixed(2)) | |
}); | |
} | |
}; | |
$(document).ready(function() { | |
mashkar.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment