L
L
Lana2019-04-08 19:17:15
css
Lana, 2019-04-08 19:17:15

How is this card made?

Hello!
I don’t know how to make such a card, it’s just added by the hour and the amount from below is summed up, etc.,
then sent by the feedback form. Please point me to resources where I can learn this.
5cab73eee5138800882236.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lana, 2020-03-30
@lanimya

<div class="goods-count">
   <span class="amount">
         <span class="down">-</span>
         <input type="text" class="counter" value="1 шт." data-price="375" data-count="1"/>
        <span class="up">+</span>
    </span>
</div>

$('.goods').on('click', function(evt) {
        var elem = evt.target;
        var container = evt.currentTarget;
        var input = container.getElementsByClassName('counter')[0];
        var sum = container.getElementsByClassName('sum')[0];
        var count = parseInt(input.getAttribute('data-count'), 10);
        var price = parseInt(input.getAttribute('data-price'), 10);
        
    	if (elem.classList.contains('down')) {
        	count = count == 1 ? count : (count - 1);
        } else if (elem.classList.contains('up')){
        	count += 1;
        }
        console.log(count)
        input.value = count + ' шт.';
        sum.innerHTML = price * count;
        input.setAttribute('data-count', count);
    });

K
Kirill Proger, 2019-04-08
@freekirill

we do the field with - and + through JS , where we drive the quantity (1) into the block with the ID of the amount of 500 rubles, recalculate through JS further, when the ORDER button is pressed, we collect the quantity, cost and send a POST request to the application processor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question