title: How to preserve checked checkbox after closing the modal?
body: <p>I have a modal that looks like this:
  <a href="https://i.stack.imgur.com/9AfNF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9AfNF.png" alt="enter image description here"></a></p>
  
  <p>After few checkboxes has been checked and after clicking on <code>Add Users to New Group</code> modal closes and I'm catching values of checked checkboxes. But now I need those checkboxes that were checked before closing modal to stay checked after opening modal again, so that user can see which one of checkboxes he checked, if that is even possible to do. Here is what I tried:</p>
  
  <pre><code>$(document).ready(function(){
       $('#addNewMembers').click(function(){//click on Add Users to New Group button
       var selected = $('#ovdjeSuSelektovani').val();//im putting value of all checked checkboxes inside hidden input, so this is how i'm retrieving those values
       console.log(selected);
       if(selected!='') {
          var arrayOfSelected = selected.split(",");
          for(var i=0;i&lt;arrayOfSelected.length;i++){
              $('checkbox value=['+arrayOfSelected[i]+']').prop('checked',true);//did not recognize the jQuery selector
          }
          var numberOfSelected=arrayOfSelected.length;
          $('#numberOfMembers').text(numberOfSelected)
      }else{//neko upozorenje    
      }    
  });
  </code></pre>
  
  <p>Did not work.
  Attempt No.2:</p>
  
  <pre><code>$("#modal-6 input[type='checkbox']:checked").each(function () {
         this.prop('checked',true);
  });
  </code></pre>
  
  <p>Did nothing after reopening the modal. If anyone has any advice, I would be glad to try it.</p>