title: Javascript checkbox onChange
body: <p>I have a checkbox in a form and I'd like it to work according to following scenario: </p>
  
  <ul>
  <li>if someone checks it, the value of a textfield (<code>totalCost</code>) should be set to <code>10</code>. </li>
  <li>then, if I go back and uncheck it, a function <code>calculate()</code> sets the value of <code>totalCost</code> according to other parameters in the form. </li>
  </ul>
  
  <p>So basically, I need the part where, when I check the checkbox I do one thing and when I uncheck it, I do another.</p>