Help plz, there is a script receiving the value (and to check it output to the console) and the button on which the value hangs click on the link when clicked. It is required to pass the variable to the link:

<script> function qty() { var q = document.getElementById('qty').getAttribute('aria-valuenow'); console.log(q); } </script> 

Button next:

<button type="button" onclick="window.location.href='/cart/create?id=2&q='ВОТ ТУТ ПЕРЕМЕННАЯ" class="qwe"></button>

the point is that when a person presses a spinner (and increases the number that falls into the variable) and then presses the button, the button transfers the number to the controller (which is the q variable).

  • 3
    location.href='/cart/create?id=2&q='+qty() , and return q; in the function not to forget ... - vp_arth
  • thank you so much! in the options that I tried, I forgot to forget the result .. therefore it did not work. - user8494502

1 answer 1

location.href='/cart/create?id=2&q='+qty() , and return q; in the function do not forget ..

  • You just copied the comment, but the comment exists for short. The answer is expected to be more detailed. Complete the answer, how it helped you in solving your question. - 0xdb