title: bootstrap multiple select , How to select the whole group items after selected group
body: <p>all!
  Is the <strong><a href="https://silviomoreto.github.io/bootstrap-select/examples/" rel="nofollow noreferrer">bootstrap-select</a></strong> possible to select the group ?</p>
  
  <p>which is mean when I selecting a group , it could auto selected the belong group item (optgroup) by jquery</p>
  
  <p>for the bootstrap-select is not allow to select the  ! 
  so i use other way to make it like an group  ..</p>
  
  <pre><code>&lt;select class="selectpicker" id="join_person" multiple&gt;
  
      &lt;option id="A"&gt;group1&lt;/option&gt;
      &lt;option class="A" id="1"&gt;andy&lt;/option&gt;
      &lt;option class="A" id="2"&gt;peter&lt;/option&gt;
      &lt;option class="A" id="3"&gt;amy&lt;/option&gt;
  
      &lt;option id="B"&gt;group2&lt;/option&gt;
      &lt;option class="B" id="4"&gt;kelly&lt;/option&gt;
      &lt;option class="B" id="5"&gt;tim&lt;/option&gt;
  
  &lt;/select&gt;
  </code></pre>
  
  <p>And i need it.. when select the group ,it will not select itself ,contrarily to select all the same class with the group id ...</p>
  
  <p>and push the selected item id to an Array! </p>
  
  <p>now i can only get all selected item.... is there any idea for my case ...
  thank you so</p>
  
  <pre><code>var arr = new Array();
  $('#join_person').on('change', function(){
  
       $(this).find("option").each(function()
       {
           if($(this).is(":selected"))
           {             
              id = $(this).attr("id");
              class_dept = $(this).attr("class");
              if(id == class_dept){
                  //do something
                  }
              if(arr.indexOf(id) == -1)
              {
                 arr.push(id); 
              }
           }
           else
           {
               id = $(this).attr("id");
               arr = jQuery.grep(arr, function(value) {
               return value != id;
              });             
           }
       });
  
      alert("Last selected : " + arr[arr.length-1] +" | array_item:"+ arr);
  
    });
  </code></pre>