title: How to make key value pair array when chekbox checked using jquery?
body: <p>I have multiple checkbox, when i check a checkbox two key value pair will generate.<br>
  Like this : <code>Object {id: "101", name: "example"}</code><br><br>
  This will generate for every checkbox checked and i want for multiple checkbox checked array. look like this :</p>
  
  <pre><code>[{id:"id1",name:"name1"},{id:"id2",name:"name2"}]
  </code></pre>
  
  <p>What I have done </p>
  
  <pre><code>$('.chkCompare').click(function(event) {
      var value = [],
          projectName = {},
          span = $(this).attr('id'),
          value = $('.chkCompare:checked').map(function() {
              $('#span' + span).text('ADDED').css({
                  "color": "green"
              });
              projectName['id'] = $(this).attr('id');
              projectName['name'] = $(this).attr('title');
              return value.push(projectName);
          }).get();
  });
  </code></pre>
  
  <p>When I uncheck checkbox they will be remove from array and want to prevent check maximum 3 checkbox <code>if &gt;3</code> then show an alert box.</p>