On Change Dropdwon Change Price
Form:
<select class="form-control" id="{{'qty-'.$product->product_id }}" onchange="changePrice({{$product->product_id}})"> @foreach($productVegetabledetail as $productVarient) <option value="{{ $productVarient->varient }}-{{ $productVarient->price }}">{{ $productVarient->varient.'-'.($productVarient->unit == 1 ? 'kgs' : 'grms')}}</option> @endforeach</select>
Javascript:
<script type="text/javascript">function changePrice(productId) { var price = $("#qty-"+productId).val(); var array = price.split("-"); var totalPrice = parseFloat(array[1]).toFixed(2); document.getElementById("price-"+productId).innerHTML = totalPrice +'<i class="mdi mdi-currency-inr"></i>';}</script>