Answer the question
In order to leave comments, you need to log in
How to pass a variable to another page?
Hello
There are 2 pages
1 page - add value `value input[type="checkbox"]`
jsfiddle.net/Lprptmgk
$('.checkbox-price-bind').on('change', function() {
$('.checkbox-price-bind').prop('checked', this.checked);
});
$("input[type=checkbox]").change(function() {
calculate();
});
function calculate() {
var sum = 0;
$("[id^=add-price-]:checked").each(function() {
sum += parseInt($(this).val(), 10);
});
if(sum < 469){
$('input[type="submit"]').attr('disabled','disabled');
alert('У Вас не выбрано ни один из заказов. Пожалуйста отметьте необходимый Вам заказ!');
}
else{
$('input[type="submit"]').removeAttr('disabled');
}
$("#summ-price > span").html(sum);
}
<form method="post" action="next_page.php" >
<input type="checkbox" id="add-price-1" class="checkbox-price checkbox-price-list checkbox-price-bind" name="price" value="980" />
<label for="add-price-1"><span></span> Price1 - <b>980</b></label>
<br>
<br>
<input type="checkbox" id="add-price-2" class="checkbox-price checkbox-price-list" name="price" value="470" checked />
<label for="add-price-2"><span></span> Price2 - <b>470</b></label>
<br>
<br>
<input type="submit" id="submit" value="Оформить заказ »" />
<p id="summ-price">Сумма: <span>470</span> р</p>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question