Answer the question
In order to leave comments, you need to log in
How to pass value to js?
For example, there is an input
<input type="text" class="qty-input" name="quantity" size="2" value="1" />
<a onclick="addToCart('<?php echo $result['product_id']; ?>', '1');" class="btn btn-cart">Добавить в корзину</a>
addToCart('<?php echo $result['product_id']; ?>', '1');
(respectively instead of '1') ? addToCart('<?php echo $result['product_id']; ?>', document.getElementById('quantity').value);"
I tried, but it takes the initial value of the input, and as I said, its value changes and you need ...
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