Process Jquery fuction only once
<p>HTML&amp;PHP</p>

<p>I list ticket info;</p>

<pre class="lang-php prettyprint-override"><code>  &lt;table&gt;      
  &lt;?php
  while($values = mysql_fetch_array($ticketInfo)){ 
    echo '&lt;tr&gt;';
    echo '&lt;td id="ticketPrice"&gt;'. $values['ticket_price'] .'&lt;/td&gt;';
    echo '&lt;td id="myBonus"&gt;'. $values['bonus']*5 .'&lt;/td&gt;';
    echo '&lt;td&gt;&lt;input type="checkbox" name="use_bonus" onclick="useMyBonus();"  id="myBonusId" /&gt;&lt;/td&gt;';
    echo '&lt;/tr&gt;';
  }      
  ?&gt;
  &lt;/table&gt;
</code></pre>

<p>When user click checkbox process a jquery script for calculate discount with use bonus and write returning data to ticketPrice ID. But there is multiple checkbox and if user click another checkbox script calculate again but I don't this. How can I process it only once?</p>

<p>My jquery Code;</p>

<pre><code>  function useMyBonus(){
    myBonus         = parseInt($("#myBonus").text());
    ticketPrice     = parseInt($("#ticketPrice").text());
    checked         = $("#myBonusId").is(':checked');



    if(checked == true){
        $("#ticketPrice").text(ticketPrice-(myBonus/2));

    }else{
        $("#ticketPrice").text(ticketPrice+(myBonus/2));

    }
} 
</code></pre>
