title: Enabled and disabled checkbox using javascript
body: <p>This is my checkbox and text box:</p>
  
  <pre><code>&lt;td&gt; &lt;input type ="checkbox" id="haha" onclick="enable('&lt;?php echo $agenda-&gt;id; ?&gt;')" value=&lt;?php echo $agenda-&gt;id; ?&gt;&gt;
  
  &lt;td&gt; &lt;input type="text" name="dnama" id="nama_&lt;?php echo $agenda-&gt;id; ?&gt;" value="&lt;?php echo $agenda-&gt;nama; ?&gt;" disabled /&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type="text" name="dketer" id="ket_&lt;?php echo $agenda-&gt;id; ?&gt;" value="&lt;?php echo $agenda-&gt;keterangan; ?&gt;" disabled&gt; &lt;/td&gt;
  </code></pre>
  
  <p>and here's my javascript:</p>
  
  <pre><code>function enable(id) {
  var disabled = !document.getElementById('haha').checked;
  document.getElementById("nama_"+id).disabled = disabled;
  document.getElementById("ket_"+id).disabled = disabled; }
  </code></pre>
  
  <p>my question is why this is only works on first row, i checked first checkbox the textbox will be enabled and then i unchecked first checkbox and checked 2nd and others that textbox still disabled.. how can i fix this?</p>