<div class="countProduct">
<input class="countProduct__input" type="number" name="countProdict_id1" id="countProdict_id1" value="1">
<button type="button" onclick="quantityMinus('countProdict_id1')" class="countProduct__btn countProduct__btn--inc">
-
</button>
<button type="button" onclick="quantityPlus('countProdict_id1')" class="countProduct__btn countProduct__btn--dec">
+
</button>
</div>
<div class="countProduct">
<input class="countProduct__input" type="number" name="countProdict_id2" id="countProdict_id2" value="1">
<button type="button" onclick="quantityMinus('countProdict_id2')" class="countProduct__btn countProduct__btn--inc">
-
</button>
<button type="button" onclick="quantityPlus('countProdict_id2')" class="countProduct__btn countProduct__btn--dec">
+
</button>
</div>
function quantityMinus(target) {
let input = document.getElemetById(target);
if (input.value > 1) {
input.value= input.val() - 1;
}
}
function quantityPlus(target) {
let input = document.getElemetById(target);
input.value = input.value + 1;
}
<style>
.modal.fade{
display:none;
position: fixed;
top:50%;
left:50%;
background-color: aquamarine;
padding: 30px;
}
.modal.fade.open{
display:block;
}
</style>
<div id="modal" class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content tx-size-sm">
<div class="modal-body tx-center pd-y-20 pd-x-20">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<i class="icon ion-ios-checkmark-outline tx-100 tx-success lh-1 mg-t-20 d-inline-block"></i>
<h4 class="tx-success tx-semibold mg-b-20">Поздравляем!</h4>
<p class="mg-b-20 mg-x-20"><?php echo $_SESSION['success']; unset($_SESSION['success']); ?></p>
<button type="button" class="btn btn-success pd-x-25" data-dismiss="modal" aria-label="Close">Продолжить</button>
</div>
</div>
</div>
</div>
<script type= text/javascript>
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById('modal').classList.add('open');
});
</script>
<button class="btn-buy" onclick=cart.remove({"кроме":7})>
cart={
remove(data){
let blocks = document.getElementsByClassName("table-cart--section");
for (let block in blocks){
if (blocks[block].dataset.productid !== data["кроме"])
blocks[block].ParrentNode.RemoveChilde(blocks[block])
}
}
}
fetch(URL_forGetSelectData,
).then(function (response) {
return response.json();
}).then(function (response) {
// если даные пришли в виде html: '<option value="value_1">name_1</option><option value="value_n">name_n</option>'
document.getElementById("selectId").innerHTML=response;
// или если данные пришли в виде json примерно :
// response = {
// "name_1":"value_1",
// //...
// "name_n":"value_n",
// };
let fragment = document.createDocumentFragment();
for (let option in response){
let optionElem = new Option(option, response[option]);
fragment.appendChild(optionElem);
}
document.getElementById("selectId").appendChild(fragment);
return;
}).catch(function (error) {
console.log(error);
});