Calculate Full Value Of Checkboxes Using Jquery

If 1 checkbox is selected, it volition add together the values of checkboxes automatically. If you lot volition click unchecked, the full volition survive updated automatically.
JQUERY
 $(document).ready(function() { $("input[type=checkbox]").change(function(){   recalculate(); }); role recalculate(){     var substance = 0;     $("input[type=checkbox]:checked").each(function(){       substance += parseInt($(this).attr("rel"));     });   //  alert(sum); $("#output").html(sum); } });
HTML
<div id="school">     <p><input type="checkbox" rel="15">Book</p>     <p><input type="checkbox" rel="15">Bag</p>     <p><input type="checkbox" rel="15">Notebook</p> </div>  <span id="output"></span> 

Ref: http://stackoverflow.com/questions/5066537/calculate-total-value-checkboxes-jquery
Sumber http://developer-paradize.blogspot.com

Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?