title: Pass checkbox value to a text field when user click it
body: <p>I will pass value for multiple fields to a text field. There is a problem, checkbox. How to make sure that if the checkbox (allowance) only pass value to text field if user check it?</p>
  
  <p><a href="http://jsfiddle.net/e2ScF/55/" rel="nofollow">http://jsfiddle.net/e2ScF/55/</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;select id="Salary_para1"&gt;
    &lt;option value=""&gt;Choose...&lt;/option&gt;
    &lt;option value="MYR" selected&gt;MYR&lt;/option&gt;
    &lt;option value="SGD" &gt;SGD&lt;/option&gt;
  &lt;/select&gt;
  &lt;input id="Salary_value" type="text"/&gt;
  + &lt;input type="checkbox" id="Salary_para2" name="Salary_para2" value=" + Allowance"  /&gt;Allowance&lt;br/&gt;
  &lt;input type="text" id="targetTextField" name="targetTextField" size="31" tabindex="0" maxlength="99" value=""&gt;
  </code></pre>
  
  <p>CODE:</p>
  
  <pre><code>$(function() {
    $("#Salary_para1").change(function(){
      setTarget()
    });
    $("#Salary_para2").change(function(){
      setTarget()
    });
    $("#Salary_value").keyup(function(){
      setTarget();
    });
  });
  
  function setTarget(){
    var tmp = $("#Salary_para1").val();
    tmp += $("#Salary_value").val();
    tmp += $("#Salary_para2").val();
    $('#targetTextField').val(tmp);
  }
  </code></pre>