drsrq26482
2015-08-26 01:08
浏览 318
已采纳

选中一个复选框后,禁用所有复选框

im like two days fighting against this, and i wish some1 can help

im using a PHP that generats 4 checkboxes

<form method="post" class="car_booking_form"  >
<div class="booking-item-price-calc">
<div class="row row-wrap">
    <div class="col-md-<?php echo esc_attr($col) ?> singe_cars" data-car-id="<?php the_ID()?>">
        <?php $list = get_post_meta(get_the_ID(),'cars_equipment_list',true); ?>
        <?php
        if(!empty($list)){
            foreach($list as $k=>$v){
                $v['cars_equipment_list_price'] = apply_filters('st_apply_tax_amount',$v['cars_equipment_list_price']);

                $price_unit = isset($v['price_unit'])? $v['price_unit']: '';

                $price_unit_html='';
                switch($price_unit)
                {
                    case "per_hour":
                        $price_unit_html=__('/hour',ST_TEXTDOMAIN);
                        break;
                    case "per_day":
                        $price_unit_html=__('',ST_TEXTDOMAIN);
                        break;
                    default:
                        $price_unit_html=__('',ST_TEXTDOMAIN);
                        break;
                }
                echo '<div class="checkbox">
                        <label>
                            <input class="i-check equipment" data-price-unit="'.$price_unit.'" data-title="'.$v['title'].'" data-price="'.$v['cars_equipment_list_price'].'" type="checkbox" />'.$v['title'].'
                            <span class="pull-right">'.TravelHelper::format_money($v['cars_equipment_list_price']).''.$price_unit_html.'</span>
                        </label>
                   </div>';
            }
        }
        ?>

if i hade 4 normal labels i could give theme Ids and use a JS script, now the Checkboxs gets generated automatically and i dont know how to manage it so when a Checkbox is checked the other 3 gets disabled

thanks and sorry for my bad EN

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题