title: How to GetChecked values and Remove unchecked in array
body: <p>i use array for checkbox value,
  if i click on checkbox it gets values,and if i uncheck this checkbox it remove its value and not save in array,here is my Code..</p>
  
  <pre><code>function selectUser(sender) {
          if (sender.prop('checked'),true)
              assignedTo[assignedTo.length] = sender.id;   
          else {
              for (var i = 0; i &lt; assignedTo.length; i++) {
                  if (sender.id == assignedTo[i]) {
                      assignedTo.splice(i, 1);
                      break;
                  }
              }
          }
      }
  </code></pre>
  
  <p>Now My issue is if checked it saves value and if i uncheck it did not remove value from array,any help</p>