Jquery for each closest, calculate and replace values
<p>I am having a bit of trouble trying to replace calculated values. In this function we are trying to use the value of the hidden text box calculate a discount and replace the original price with the new discounted value. I can get the discounts and values, but it will not replace the values into the div..I am thinking my "closest" is not working...Any thoughts what I am doing wrong here.</p>

<pre><code>$(document).ready(function() {
    $("#cal_discount").click(function() {

        $(".price_val").each(function() {
            var Percent = $('#percent_dis').val();
            var price = $(this).val();
            var existing = $(this).closest('.existing_price');
            var new_price = (price - (price * (Percent / 100)));
            var formatted = new_price.toFixed(2);
            existing.text(formatted);
        });
    });
});

&lt;div class="existing_price" style="float:left"&gt;22&lt;/div&gt;
&lt;input  type="hidden"  class="price_val" value="22" /&gt;

&lt;input name="percent_dis" type="text" id="percent_dis" size="3" /&gt; %      &lt;img src="admin/images/btn/cal_discount.png" width="97" height="17" style="float:left; margin-right:10px; margin-top:5px; cursor:pointer" id="cal_discount" /&gt;   
</code></pre>
