[英]How to use radio type as button without submit form?
我在表單上使用單選按鈕:
<div class="d-block">
<div class="btn-group" role="group" aria-label="Basic example">
<button type="radio" name="type" value="rent" style="padding-right: 0 !important;" class="btn btn-lg btn-secondary pr-4 pl-0 active" id="left">{{ __('Rent') }}</button>
<button type="radio" name="type" value="buy" style="padding-right: 0 !important;" class="btn btn-lg btn-light pr-4 pl-0" id="right">{{ __('Sale') }}</button>
</div>
</div>
如何在沒有提交表格的情況下在租用和購買按鈕之間切換?
它應該是input
而不是button
<div class="d-block"> <div class="btn-group" role="group" aria-label="Basic example"> <input type="radio" name="type" value="rent" style="padding-right: 0 !important;" class="btn btn-lg btn-secondary pr-4 pl-0 active" id="left">{{ __('Rent') }}</input> <input type="radio" name="type" value="buy" style="padding-right: 0 !important;" class="btn btn-lg btn-light pr-4 pl-0" id="right">{{ __('Sale') }}</input> </div> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.