首页 > 解决方案 > 单击时识别重复的行值

问题描述

如果行officelocation_id中的行不同,我将选择行,但我面临识别officelocation_id所有行以应用条件以仅选择相同的问题officelocation_id

 <table class="supplier_inquiry_indextable">
  <tr>
     <th>Check</th>
     <th>Office location</th>
  </tr>
    <?php foreach ($purchaseOrder as $key=>$supplierInquiry): ?>            
   <tr class="inquiryrow">
      <td>
       <?php echo $this->Form->checkbox("data.$key.selectpr", array('class'=>'selectcheck', 'value'=>supplierInquiry->id));?>
    </td>
   <td><php echo $supplierInquiry['office'];

      echo $this->Form->hidden("data.$key.officelocation_id",[ 'class'=>'officelocation_id ', 'value'=>$supplierInquiry['officelocation_id']]);?>
     </td>
       </tr>
   </table>
  <script>
  $(document).ready(function() {
      $(".supplier_inquiry_indextable").each(function(){
            $(this).find(".inquiryrow").each(function(){
        var inqrow=this;
         $(inqrow).find(".suppliername").prop('disabled', true);
        $(inqrow).find(".selectcheck").click(function(){
            var ischecked= $(this).is(':checked');
            if(ischecked){
                $(inqrow).css('background-color','#3c8dbc');
            }else if(!ischecked){
                $(inqrow).css('background-color','white');
                //$(inqrow).empty();
            }
        });

         });
      });

     });

  </script>

在我上面的代码中,我能够找到选定的行,但单击时我必须选择唯一相同的办公位置,否则会出现警报。

标签: jquery

解决方案


推荐阅读