我想在点击其中之一时添加价格
<div class="col-12 col-sm-9 col-md-9 col-lg-8">
<select class="form-control" type="text" value="">
<option value="0">Not Required</option>
<option value="50">Before Care only(6am to 9am)</option>
<option value="60">After Care Only (5pm to 7pm)</option>
<option value="110">Both</option>
</select>
</div>
应该添加他们的购物车总数
<h4 class="price" id="prictot">{{$cdetail ->c_price}}</h4>
<form action="{{ route('/payment') }}" id="theForm" method="POST">
@csrf
<input type="hidden" id="price" name="price" value="{{$cdetail ->price}}"><br>
<button type="submit" class="btn radius-xl text-uppercase">Buy This Courses</button>
</form>
使用ajax并获取值并放入“prictot”
<script>
$(document).ready(function() {
$("#priceadd").on('change', function () {
var optionText = $("#priceadd option:selected").val();
realprice=document.getElementById("prictot").innerHTML
document.getElementById("prictot").innerHTML = optionText
});
});
</script>
德玛西亚99