jeudi 15 février 2018

Trying to add values from a check box into a progress bar

There's a cool graphic to display progress. First crack to change the input from text field to checkbox was was something like this.

Code:

$(document).ready(function($) {
   var sum = 0;

   $("input:checkbox").click(function() {
       sum = 0;
       $("input:checkbox:checked").each(function(idx, elm) {
           sum += parseInt(elm.value, 10);
       });

       return sum  
   });
});

such that there are 10 checkboxes each one representing 10% completion of a task and the combined checkboxes leads to 100% how would you modify this? https://codepen.io/junebug12851/pen/mJZNqN




Aucun commentaire:

Enregistrer un commentaire