Hi friends I have two variables price1 & price 2, I am getting price value dynamically using onchange event now i want to add these two variables.
//get support layer firmness price
$('.support-layer-firmness').on('change', function(e) {
//first price
var price1 = 300;
});
$('.support-layer-thickness').on('change', function(e) {
//second price
var price2 = 200;
});
Now I want to add both variables price1 & price2
eg price = price1+price2;
o/p price= 500;
how can i achieve this..
price1andprice2outside the functions to make them global. Then ononChangeevent call a function to update the price, e.gupdatePrice = function(){return price1 + price2;}