title: How to disable another checkbox when one checkbox has been ticked?(renew)
body: <p>to make my question before clearly</p>
  
  <p>use sql server 2008 enterprise as database server
  check my code </p>
  
  <p><strong>table view</strong></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;form method="post" name="form" id="checkForm" action="update.php"&gt;
  
  &lt;?php
  $aksi="aksi_view.php";
  switch($_GET[act]){
    // Tampil User
    default:
  
      echo "
      &lt;table&gt;
      &lt;tr&gt;&lt;th&gt;Ap&lt;/th&gt;&lt;th&gt;Ccl&lt;/th&gt;&lt;th&gt;No&lt;/th&gt;&lt;th&gt;Budg&lt;/th&gt;&lt;th&gt;Dept&lt;/th&gt;&lt;th&gt;ItemID&lt;/th&gt;&lt;th&gt;Item Name&lt;/th&gt;&lt;th&gt;Qnty&lt;/th&gt;&lt;th&gt;UOM&lt;/th&gt;&lt;th&gt;Curr.&lt;/th&gt;&lt;th&gt;Rate&lt;/th&gt;&lt;th&gt;Unit Price&lt;/th&gt;
      &lt;th&gt;Total&lt;/th&gt;&lt;th&gt;Total-IDR&lt;/th&gt;&lt;/tr&gt;";
  
      $p      = new Paging;
      $batas  = 20;
      $posisi = $p-&gt;cariPosisi($batas);
  
      $counter = 1;
  
      $sql = "SELECT TOP 20 BudgetCategoryID,DeptAbbr, BudgetCategoryAbbr, ItemID, Status,
                              QntyDept, Qnty, CurrencyID, UnitPrice, ExchangeRateIDR, Remark,Proposal,
                              DeptApprovalRemark, M2ApprovalBy, M2ApprovalRemark, ItemName, PurchaseUOMName,
                              DecimalInQnty,(Qnty*UnitPrice) as Total, TotalIDR, CompanyDeptStock, CompanyDeptID, OutstandingNPBB
                              FROM vwBudgetApproval
                              WHERE (M2ApprovalBy IS NOT NULL OR (M2ApprovalBy IS NULL AND  Status =1)) AND 
                              CompletedInd = 1 AND DeptApprovalBy IS NOT NULL 
                              ORDER BY BudgetCategoryID, ItemID";
      $tampil = mssql_query($sql) ;
  
  $no = $posisi+1;
  
  while($r=mssql_fetch_array($tampil)){
    // echo"$no=2 '-'"; 
     //echo"$r[ItemID]";
        $ExchangeRateIDR = number_format($r['ExchangeRateIDR'],2,',','.');
      $unitprice = number_format($r['UnitPrice'],2,',','.'); 
      $total = number_format($r['Total'],2,',','.');
      $totalidr = number_format($r['TotalIDR'],2,',','.');
  
  
      $warnaGenap = "#66CCFF";   // warna abu-abu
      $warnaGanjil = "#FFFFFF";  // warna putih
  
  if ($counter % 2 == 0) $warna = $warnaGenap;
  else $warna = $warnaGanjil;
  
  
  echo "&lt;tr bgcolor='".$warna."'&gt;            
  
  
   &lt;td&gt;&lt;input type= 'checkbox' name='approve".$no."' id='approve'   value='".$r['ItemID']."' onclick='onClickFn()'&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type= 'checkbox' name='cancel".$no."' id='cancel'   value='".$r['ItemID']."' onclick='onClickFn()'&gt;&lt;/td&gt; 
                      &lt;td&gt;$no&lt;/td&gt;
                      &lt;td&gt;$r[BudgetCategoryAbbr]&lt;/td&gt;
                      &lt;td&gt;$r[DeptAbbr]&lt;/td&gt;
                      &lt;td&gt;$r[ItemID]&lt;/td&gt;
                      &lt;td&gt;$r[ItemName]&lt;/td&gt;
                      &lt;td&gt;$r[Qnty]&lt;/td&gt;
                      &lt;td&gt;$r[PurchaseUOMName]&lt;/td&gt;
                      &lt;td&gt;$r[CurrencyID]&lt;/td&gt;
                      &lt;td&gt;$r[ExchangeRateIDR]&lt;/td&gt;
                      &lt;td&gt;$unitprice &lt;/td&gt;
                      &lt;td&gt;$total&lt;/td&gt;
                      &lt;td&gt;Rp $totalidr&lt;/td&gt;";             
            $no++;
            $counter++;
  
          }
      echo "&lt;/table&gt;";
  ?&gt;
  </code></pre>
  
  <p>show of the page</p>
  
  <p><img src="https://i.stack.imgur.com/F9tPm.png" alt="images"></p>
  
  <p>now i want the user when checked one checkboxe the other checkbox disable
  i use the java script for function. here my code</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function onClickFn(){
  $("approve").click(function(){
      if ($(this).prop("checked"))
      {
          $("cancel").prop("checked",false);
      }
  });
  
  $("cancel").click(function(){
      if ($(this).prop("checked"))
      {
          $("approve").prop("checked",false);
      }
  })
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>but that function does not work.</p>