E
E
Evgeniy2020-10-03 15:39:09
JavaScript
Evgeniy, 2020-10-03 15:39:09

How to display cart items in a modal window in bootstrap 4 using js?

Good afternoon, could you please tell me how to quickly implement such a task?
What day I fight

When adding products, a list is displayed on the page itself, after clicking on the "Place an order" button
And in the modal window these products are no longer displayed

https://codepen.io/Zhelezniy/pen/QWNedQE

How to make it so that in modal window they were?

for example, opened a modal window with a product, clicked add to cart.
then opened the shopping cart in the modal window, and here is the whole list of products

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Gnevyshev, 2020-10-03
@iResource

The question is not very clear.
But, if I understand correctly, you want that when adding a product to the cart, it appears immediately in one block, and simultaneously in another block, inside the modal window. So?
If so, then I see 2 solutions, perhaps there is a dependence on what / how goods are added to the initial block.
Option 1 - respond to the button click event - change js to add the product immediately and to another block, which is inside the modal.
Option 2 - use MutationObserver - monitor the state of the original block. When it changes - read and change the second block inside the modal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question