2012-02-28 17 views
0

を選択するための複数の時間を確認しました。ここ 何実際に問題がチェックボックスであることは、私が最初に二回クリックしただけの値を変更します。私は初めて他のテキストボックスを無効にするために2回クリックする必要があります。それ以外の場合は、正常に動作します。ここで私は私のjqueryの機能を与えている :チェックボックスは、私がtrueに設定すると、他のテキストボックスを無効にするには持っているチェックボックスを持っている価値

function bundlecheckout(val,total) 
{ 

    $("#file_check"+val).click(function() { 
     $('input[id^="file_check"]').attr("checked", false); 
     //$("#file_check"+val).unbind('click'); 
     $(this).attr('checked', true); 
     $("#checkout").attr("disabled", !this.checked); 
     for(i=0;i<=total+1;i++) 
     {    
      if(i !=val){   
      $("#txtinstruction"+i).attr("disabled", this.checked); 
      $("#txturl"+i).attr("disabled", this.checked); 
     } 
     else{ 
      $("#txtinstruction"+i).removeAttr("disabled"); 
      $("#txturl"+i).removeAttr("disabled"); 
      } 
     } 
    }  
);} 

チェックボックス要素

<input type="checkbox" class="file_check" name="file_upload_check" value="<?php echo $testing_type_id;?>" id="file_check<?php echo $testing_type_id;?>" onclick="bundlecheckout(<?php echo $testing_type_id;?>,<?php echo $total ?>);"/>Apply<br /> 
+0

PHPコードを投稿のポイントは何ですか? –

+0

@ Col.Shrapnel、ここにPHPはありません。 –

+0

実際には(そうでなければ、私はそのような質問に遭遇することはありません:)。しかし、PHPがjqueryで動作しないため、PHPコードの投稿には全く意味がありません。 Col.Shrapnel @ –

答えて

0

は、以下のコードを試してみてください。私はクリック自体にクリックイベントをバインドする理由がわかりません。

function bundlecheckout(val,total,e) 
    { 
      $('input[id^="file_check"]').attr("checked", false); 
      //$("#file_check"+val).unbind('click'); 
      $(e).attr('checked', true); 
      $("#checkout").attr("disabled", !this.checked); 
      for(i=0;i<=total+1;i++) 
      {    
       if(i !=val){   
       $("#txtinstruction"+i).attr("disabled", this.checked); 
       $("#txturl"+i).attr("disabled", this.checked); 
      } 
      else{ 
       $("#txtinstruction"+i).removeAttr("disabled"); 
       $("#txturl"+i).removeAttr("disabled"); 
       } 
      } 
     } 
<input type="checkbox" class="file_check" name="file_upload_check" value="<?php echo $testing_type_id;?>" id="file_check<?php echo $testing_type_id;?>" onclick="bundlecheckout(<?php echo $testing_type_id;?>,<?php echo $total ?>,this);"/>Apply<br /> 
関連する問題