0
は私がWooCommerceによって生成されたコードの以下のビットが使用可能な配送オプションを表示する必要があります:最初のラジオボタンが選択されている場合特定のラジオボタンがチェックされている場合、残りのラジオボタンを無効にする方法はありますか?
<ul id="shipping_method">
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flat_rate5" value="flat_rate:5" class="shipping_method" checked='checked' />
<label for="shipping_method_0_flat_rate5">Call 386-410-4757 for Shipping Quote</label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_wf_shipping_uspsd_express_mail" value="wf_shipping_usps:D_EXPRESS_MAIL" class="shipping_method" />
<label for="shipping_method_0_wf_shipping_uspsd_express_mail">Priority Mail Express™ (USPS): <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>22.95</span></label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_wf_shipping_uspsd_priority_mail" value="wf_shipping_usps:D_PRIORITY_MAIL" class="shipping_method" />
<label for="shipping_method_0_wf_shipping_uspsd_priority_mail">Priority Mail® (USPS): <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>6.45</span></label>
</li>
</ul>
私は何をできるようにする必要があることは無効ラジオボタン2と3です。
私は無駄にこれを試してみました:
$('.shipping_method').click(function(){
if(this.value == 'flat_rate:5' && this.checked){
console.log($('input[value=wf_shipping_usps:D_EXPRESS_MAIL], input[value=wf_shipping_usps:D_PRIORITY_MAIL]'));
$('input[value=wf_shipping_usps:D_EXPRESS_MAIL], input[value=wf_shipping_usps:D_PRIORITY_MAIL]').prop('disabled', true);
}
else{
$('.shipping_method').not(this).prop('checked', false).prop('disabled', false);
}
});
すべてのヘルプははるかに高く評価されるだろう!
おかげで、
シンシア意味AJAXによる
名前付きグループからラジオボタンを1つだけ選択できると、他のラジオボタンを無効にすることは少し冗長に見えます。誤ってクリックすると選択を変更できないため、ユーザーにとって迷惑です。 –
する必要があります。私はWoocommerceでオンラインで計算することができない出荷を求めるために必要な数少ない製品を持っています。これらの製品の場合のみ、Call for Shippingは配送オプションとして表示されます。 – Cynthia