nohc,
так на всякий случай ... кофициенты кроме pa и саму формулу sum уточните сами. ;жмите
Показать исходный код
$(function () {
var $spinner1 = $(".spinner-1"),
$spinner2 = $(".spinner-2"),
$spinner3 = $(".spinner-3");
$spinner1.each(function (indx, element) {
var el1 = $(element);
var parent = el1.parents(".tab-pane");
var old = 1,
childs = 0,
days = 12;
var price = $("span[id^=price]", parent);
var pa = +$('[name="pa"]', parent).val();
var sum = function () {
price.html((old * pa + childs * pa) * days)
};
sum()
el1.tb3spinner({
"value": 1,
min: 1,
max: 6,
attrs: {
"name": "old"
},
changed: function () {
old = +$("input", el1).val();
sum()
}
});
var el2 = $spinner2.eq(indx);
el2.tb3spinner({
"value": 0,
min: 0,
max: 6,
attrs: {
"name": "childs"
},
changed: function () {
childs = +$("input", el2).val();
sum()
}
});
var el3 = $spinner3.eq(indx);
el3.tb3spinner({
"value": 12,
min: 12,
max: 60,
attrs: {
"name": "days"
},
changed: function () {
days = +$("input", el3).val();
sum()
}
})
})
});