你能帮我吗?我有5个广播输入,如果选中了广播,则需要隐藏特定的div。
收音机:交付1,交付2,交付3,交付4,交付5
如果检查交付1和5-隐藏.method1如果选中交付2,3,4-隐藏.method2
谢谢!
<ul id="shipping_method" class="woocommerce-shipping-methods">
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flexible_shipping_8_6" value="flexible_shipping_8_6" class="shipping_method" checked="checked"><label for="shipping_method_0_flexible_shipping_8_6">Česká pošta - dobírka: <span class="woocommerce-Price-amount amount">120 <span class="woocommerce-Price-currencySymbol">Kč</span></span></label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flexible_shipping_6_1" value="flexible_shipping_6_1" class="shipping_method"><label for="shipping_method_0_flexible_shipping_6_1">Platba převodem - doporučeně: <span class="woocommerce-Price-amount amount">80 <span class="woocommerce-Price-currencySymbol">Kč</span></span></label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flexible_shipping_6_3" value="flexible_shipping_6_3" class="shipping_method"><label for="shipping_method_0_flexible_shipping_6_3">Platba převodem - doporučené psaní: <span class="woocommerce-Price-amount amount">49 <span class="woocommerce-Price-currencySymbol">Kč</span></span></label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flexible_shipping_6_4" value="flexible_shipping_6_4" class="shipping_method"><label for="shipping_method_0_flexible_shipping_6_4">Platba převodem - osobní vyzvednutí v IC Praha (0 Kč)</label> </li>
<li>
<input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flexible_shipping_7_5" value="flexible_shipping_7_5" class="shipping_method"><label for="shipping_method_0_flexible_shipping_7_5">Platba hotově – osobní vyzvednutí v IC Praha (0 Kč)</label> </li>
</ul>
if(document.getElementById("delivery1").checked ||document.getElementById("delivery5").checked) {
document.getElementsByClassName("method1").style.display = "none"
} else {
document.getElementsByClassName("method2").style.display = "none"
}