I am using jQuery to calculate prices. Here is a small snippet of my JavaScript:
// Prices: radio
var curLam = "gloss";
$("input[name=lamination]").click(function () {
var gloss = 5;
var matt = 6;
if ($(this).val() == 'gloss' && curLam != 'gloss') {
$('#prices span').text(parseInt($('#prices span').text()) + gloss - matt);
curLam = 'gloss';
console.log('1');
}
if ($(this).val() == 'matt' && curLam != 'matt') {
$('#prices span').text(parseInt($('#prices span').text()) - gloss + matt);
curLam = 'matt';
console.log('2');
}
$("#prices span").each(function () {
var $priceValue = $(this);
})
});
This checks to see if a matte or gloss finish has been selected and then it inserts the price into the span
within the prices
div
tag.
I need to know how to assign that price value into a variable which can then be passed on to PHP for my shopping cart.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…