0

I'm using Laravel for creating shopping cart so I want to make something for select number of product by customer and when customer click e.g on number 2 page will be refresh and new price is going to show my problem is that I don't know how can I make a select box as a button that whenever each user click on each number something happen

here is my html

  <div class="selectric-hide-select">
          <select class="c-ui-select js-ui-select" id="expressShipping-count-0" autocomplete="off" tabindex="-1">
           <option value="1">۱</option>
                       <option value="2">۲</option>
                       <option value="3">۳</option>
                       <option value="4" selected="">۴</option>
                       <option value="5">۵</option>
           </select>
   </div>
Vincent Decaux
  • 9,857
  • 6
  • 56
  • 84
hassan khosro
  • 149
  • 1
  • 16

1 Answers1

0

You don't need to have button inside select box rather you can make use of change event of select box and refresh the prize.

see below code

$(function(){
   $('#expressShipping-count-0').on('change', function(){
       var value = $(this).val();
       console.log(value);
       // recalculate prize and show
   });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div class="selectric-hide-select">
          <select class="c-ui-select js-ui-select" id="expressShipping-count-0" autocomplete="off" tabindex="-1">
           <option value="1">۱</option>
                       <option value="2">۲</option>
                       <option value="3">۳</option>
                       <option value="4" selected="">۴</option>
                       <option value="5">۵</option>
           </select>
   </div>
Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57